代码拉取完成,页面将自动刷新
同步操作将从 ZhangXinYa/Identity 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
// -----------------------------------------------------------------------
// <copyright file="Program.cs" company="Kengic">
// Copyright (c) Kengic. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
using System.IO;
using System.Threading.Tasks;
using IdentityServer4.EntityFramework.DbContexts;
using Kengic.Identity.API.Data;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Serilog;
namespace Kengic.Identity.API
{
/// <summary> A program. </summary>
public static class Program
{
/// <summary> The namespace. </summary>
public static readonly string Namespace = typeof(Program).Namespace;
/// <summary> Name of the application. </summary>
public static readonly string AppName = Namespace.Substring(Namespace.LastIndexOf('.', Namespace.LastIndexOf('.') - 1) + 1);
/// <summary> Main entry-point for this application. </summary>
/// <param name="args"> The arguments. </param>
/// <returns> Exit-code for the process - 0 for success, else an error code. </returns>
public static Task Main(string[] args)
{
var configuration = GetConfiguration();
return CreateHostBuilder(configuration, args)
.Build()
.MigrateDbContext<ConfigurationDbContext>((context, services) => new ConfigurationDbContextSeed()
.SeedAsync(context, configuration)
.Wait())
.MigrateDbContext<PersistedGrantDbContext>((_, __) => { })
.MigrateDbContext<ApplicationDbContext>((context, services) =>
{
var env = services.GetService<IWebHostEnvironment>();
var logger = services.GetService<ILogger<ApplicationDbContextSeed>>();
var settings = services.GetService<IOptions<AppSettings>>();
new ApplicationDbContextSeed(services)
.SeedAsync(context, env, logger, settings, 0)
.Wait();
}).RunAsync();
}
/// <summary>
/// Creates web host builder.
/// </summary>
/// <param name="configuration">The configuration.</param>
/// <param name="args">The arguments.</param>
/// <returns>The new web host builder.</returns>
private static IHostBuilder CreateHostBuilder(IConfiguration configuration, string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder => webBuilder
.CaptureStartupErrors(false)
.UseStartup<Startup>()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseConfiguration(configuration)
.UseSerilog((ctx, config) => config
.MinimumLevel.Information()
.Enrich.FromLogContext()
.WriteTo.Debug()
.WriteTo.Console()));
/// <summary> Gets the configuration. </summary>
/// <returns> The configuration. </returns>
private static IConfiguration GetConfiguration()
{
var builder = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
.AddEnvironmentVariables();
return builder.Build();
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。