protected void Application_Start(object sender, EventArgs e) { string dbFileName = Server.MapPath("~/App_Data/DashboardDataSet.xml"); DataBaseDashboardStorage dataBaseDashboardStorage = new DataBaseDashboardStorage(); ASPxDashboardDesigner.Storage.SetDashboardStorage(dataBaseDashboardStorage); Access97ConnectionParameters accessParams = new Access97ConnectionParameters(); accessParams.FileName = Server.MapPath("~/App_Data/nwind.mdb"); DashboardSqlDataSource sqlDataSource = new DashboardSqlDataSource("SQL Data Source", accessParams); TableQuery customerReportsQuery = new TableQuery("CustomerReports"); customerReportsQuery.AddTable("CustomerReports").SelectColumns("CompanyName", "ProductName", "OrderDate", "ProductAmount"); sqlDataSource.Queries.Add(customerReportsQuery); DataSourceInMemoryStorage dataSourceStorage = new DataSourceInMemoryStorage(); dataSourceStorage.RegisterDataSource("sqlDataSource1", sqlDataSource); ASPxDashboardDesigner.Storage.SetDataSourceStorage(dataSourceStorage); ASPxDashboardDesigner.Storage.ConfigureDataConnection += Storage_ConfigureDataConnection; }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddDbContext <ReportDbContext>( options => options.UseSqlServer(Configuration.GetConnectionString("MS SQL Connection"), b => b.MigrationsAssembly(typeof(Startup).GetTypeInfo().Assembly.GetName().Name)) ); services.AddDbContext <ApplicationDbContext>(options => options.UseSqlServer( Configuration.GetConnectionString("AuthConnectionString"))); services.AddTransient <IReportBL, ReportBL>(); services.AddTransient <IUserBL, UserBL>(); services .AddMvc() .AddDefaultDashboardController((configurator, serviceProvider) => { configurator.SetConnectionStringsProvider(new DashboardConnectionStringsProvider(Configuration)); //DashboardFileStorage dashboardFileStorage = new DashboardFileStorage(FileProvider.GetFileInfo("Data/Dashboards").PhysicalPath); //configurator.SetDashboardStorage(dashboardFileStorage); DataBaseDashboardStorage dataBaseDashboardStorage = new DataBaseDashboardStorage(Configuration.GetConnectionString("MS SQL Connection")); configurator.SetDashboardStorage(dataBaseDashboardStorage); }); services.AddDevExpressControls(options => options.Resources = ResourcesType.ThirdParty | ResourcesType.DevExtreme); services.AddIdentity <ApplicationUser, IdentityRole>(options => { }) .AddEntityFrameworkStores <ApplicationDbContext>() .AddDefaultUI() .AddDefaultTokenProviders(); services.Configure <IdentityOptions>(options => { // Password settings options.Password.RequireDigit = false; // Change to true options.Password.RequiredLength = 4; options.Password.RequireNonAlphanumeric = false; options.Password.RequireUppercase = false; // change to true options.Password.RequireLowercase = false; options.Password.RequiredUniqueChars = 2; // change to 6 // Lockout settings options.Lockout.DefaultLockoutTimeSpan = TimeSpan.FromMinutes(30); options.Lockout.MaxFailedAccessAttempts = 10; options.Lockout.AllowedForNewUsers = true; // User settings options.User.RequireUniqueEmail = true; }); services.AddSession(options => { options.IdleTimeout = TimeSpan.FromHours(5); }); services.ConfigureApplicationCookie(options => { options.ExpireTimeSpan = TimeSpan.FromMinutes(60); options.AccessDeniedPath = "/Home"; options.LoginPath = "/Identity/Account/Login"; }); }