Пример #1
0
        public void ConfigureServices(IServiceCollection services)
        {
            var connectionString = Configuration.GetConnectionString("DefaultConnection");

            services.AddDbContext <AppIdentityDbContext>(options =>
                                                         options.UseSqlServer(connectionString));
            services.AddDefaultIdentity <IdentityUser>(options => options.SignIn.RequireConfirmedAccount = true)
            .AddRoles <IdentityRole>()
            .AddEntityFrameworkStores <AppIdentityDbContext>();

            services.AddDbContext <ApplicationDbContext>(options => options.UseSqlServer(connectionString))
            .AddEntityFrameworkSqlServer();

            services.AddMvc(options =>
            {
                options.ModelBinderProviders.Insert(0, new IDApplicationBinderProvider());
            });

            services.AddControllersWithViews();
            services.AddRazorPages();

            var mongoDb = new MongoDbFileManager(Configuration.GetConnectionString("MongoDbConnection"), Configuration.GetValue <string>("MongoDbFileStorageDbName"));

            services.AddSingleton(mongoDb);
        }
Пример #2
0
 public APIController(MongoDbFileManager fileManager, ApplicationDbContext context) : base(context)
 {
     _fileManager = fileManager;
 }
Пример #3
0
 public HomeController(ILogger <HomeController> logger, ApplicationDbContext context, MongoDbFileManager fileManager)
 {
     _logger      = logger;
     _context     = context;
     _fileManager = fileManager;
 }