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); }
public APIController(MongoDbFileManager fileManager, ApplicationDbContext context) : base(context) { _fileManager = fileManager; }
public HomeController(ILogger <HomeController> logger, ApplicationDbContext context, MongoDbFileManager fileManager) { _logger = logger; _context = context; _fileManager = fileManager; }