コード例 #1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllers().AddFluentValidation();

            services.AddDbContext <ApplicationDbContext>(opt =>
            {
                opt.UseSqlServer(_configuration.GetConnectionString("DefaultConnectionString"),
                                 x => x.MigrationsAssembly("DarkAdminPanel.DataAccess"));
            });

            services.AddSingleton(AutoMapperConfig.CreateMapper());

            // Register the Swagger generator, defining 1 or more Swagger documents
            services.AddSwaggerGen();

            //Adding Identity Server
            IdentityServerModule.Load(services);

            //Adding JWT
            JwtModule.Load(services, _configuration);

            //Adding Validator
            ValidatorModule.Load(services);

            //Configure DI for application services
            LogicModule.Load(services);
        }
コード例 #2
0
 private static void InitializeContainer(Container container)
 {
     AppServiceModule.Register(container);
     ServiceModule.Register(container);
     RepositoryModule.Register(container);
     DataModule.Register(container);
     ValidatorModule.Register(container);
     //FluentValidationModelValidatorProvider.Configure(GlobalConfiguration.Configuration, provider =>
     //{
     //    provider.ValidatorFactory = new ApplicationValidatorFactory(container);
     //});
 }