示例#1
0
        private static IServiceCollection AddOpenIddictUIStore <TContext>(
            this IServiceCollection services,
            Action <OpenIddictUIStoreOptions> storeOptionsAction = null)
            where TContext : DbContext, IOpenIddictUIContext
        {
            var options = new OpenIddictUIStoreOptions();

            services.AddSingleton(options);
            storeOptionsAction?.Invoke(options);

            if (options.ResolveDbContextOptions != null)
            {
                services.AddDbContext <TContext>(options.ResolveDbContextOptions);
            }
            else
            {
                services.AddDbContext <TContext>(dbCtxBuilder =>
                {
                    options.OpenIddictUIContext?.Invoke(dbCtxBuilder);
                });
            }

            services.AddScoped <IOpenIddictUIContext, TContext>();

            return(services);
        }
 public OpenIddictUIContext(
     DbContextOptions <OpenIddictUIContext> options,
     OpenIddictUIStoreOptions storeOptions
     ) : base(options, storeOptions)
 {
 }