This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
internal class Clients | |
{ | |
/// <summary> | |
/// App can access to IS | |
/// </summary> | |
/// <returns></returns> | |
public static IEnumerable<Client> Get() | |
{ | |
return new List<Client> { | |
new Client { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void ConfigureServices(IServiceCollection services) | |
{ | |
const string connectionString = @"Data Source=IdentityServer.db;"; | |
var migrationsAssembly = typeof(Startup).GetTypeInfo().Assembly.GetName().Name; | |
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); | |
services.AddDbContext<ApplicationDbContext>(builder => | |
builder.UseSqlite(connectionString, sqlOptions => sqlOptions.MigrationsAssembly(migrationsAssembly))); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. | |
public void Configure(IApplicationBuilder app, IHostingEnvironment env) | |
{ | |
if (env.IsDevelopment()) | |
{ | |
app.UseDeveloperExceptionPage(); | |
} | |
InitializeDbTestData(app); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static void InitializeDbTestData(IApplicationBuilder app) | |
{ | |
using (var scope = app.ApplicationServices.GetService<IServiceScopeFactory>().CreateScope()) | |
{ | |
scope.ServiceProvider.GetRequiredService<PersistedGrantDbContext>().Database.Migrate(); | |
scope.ServiceProvider.GetRequiredService<ConfigurationDbContext>().Database.Migrate(); | |
scope.ServiceProvider.GetRequiredService<ApplicationDbContext>().Database.Migrate(); | |
var context = scope.ServiceProvider.GetRequiredService<ConfigurationDbContext>(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dotnet ef migrations add ApplicationDb --context ApplicationDbContext | |
dotnet ef migrations add ConfigurationDb --context ConfigurationDbContext | |
dotnet ef migrations add PersistedGrantDb --context PersistedGrantDbContext |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Threading.Tasks; | |
namespace AwesomeCMSCore.Modules.Scheduled | |
{ | |
public interface IScheduledEmailService | |
{ | |
Task SendEmailBackground(); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JobStorage.Current = new SqlServerStorage(configuration.GetConnectionString("DefaultConnection")); | |
var sp = services.BuildServiceProvider(); | |
var scheduledEmailService = sp.GetService<IScheduledEmailService>(); | |
RecurringJob.AddOrUpdate("SendSubscriptionEmail", () => scheduledEmailService.SendEmailBackground(), Cron.Minutely); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Project Sdk="Microsoft.NET.Sdk.Web"> | |
<PropertyGroup> | |
<TargetFramework>netcoreapp2.2</TargetFramework> | |
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel> | |
</PropertyGroup> | |
<ItemGroup> | |
<PackageReference Include="Microsoft.AspNetCore.App" /> | |
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form [formGroup]="myForm"> | |
<div> | |
<input type="text" class="form-input" [ngModel]="name" formControlName="name" /> | |
</div> | |
<label class="form-group err-msg" *ngIf="myForm.get('name').hasError('required') && (name.get('name').dirty || myForm.get('name').touched)">Name is required</label> | |
<label class="form-group err-msg" *ngIf="myForm.get('name').hasError('whitespaces') && (name.get('name').dirty || myForm.get('name').touched)">Name is required</label> | |
<div> | |
<input type="text" class="form-input" [ngModel]="email" formControlName="email" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public user$: IUser; | |
private userStoreSubscription: Subscription = new Subscription(); | |
constructor(private store: Store<UserState>) {} | |
ngOnInit(): void { | |
this.userStoreSubscription = this.store.select(getUser).subscribe(res => { | |
this.user$ = res; | |
}); | |
} |