protected void Application_Start() { AreaRegistration.RegisterAllAreas(); RouteConfig.RegisterRoutes(RouteTable.Routes); Database.SetInitializer(new DropCreateDatabaseIfModelChanges<FiaplixContext>()); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); var builder = new ContainerBuilder(); // Register your MVC controllers. (MvcApplication is the name of // the class in Global.asax.) builder.RegisterControllers(typeof(MvcApplication).Assembly); // OPTIONAL: Register model binders that require DI. builder.RegisterModelBinders(typeof(MvcApplication).Assembly); builder.RegisterModelBinderProvider(); // OPTIONAL: Register web abstractions like HttpContextBase. builder.RegisterModule <AutofacWebTypesModule>(); // OPTIONAL: Enable property injection in view pages. builder.RegisterSource(new ViewRegistrationSource()); // OPTIONAL: Enable property injection into action filters. builder.RegisterFilterProvider(); //db context 'i mi scoped( yani request bazlı) olarak register et builder.RegisterType <ApplicationDbContext>().InstancePerRequest(); // generic repository geçici instance olarak register et builder.RegisterGeneric(typeof(Repository <>)).As(typeof(IRepository <>)).InstancePerDependency(); builder.Register(c => HttpContext.Current.GetOwinContext().Authentication.User.Identity).As <System.Security.Principal.IIdentity>(); builder.RegisterType(typeof(UnitOfWork)).As(typeof(IUnitOfWork)).InstancePerRequest(); //servisleri register et builder.RegisterType(typeof(CustomerService)).As(typeof(ICustomerService)).InstancePerDependency(); builder.RegisterType(typeof(CategoryService)).As(typeof(ICategoryService)).InstancePerDependency(); builder.RegisterType(typeof(EmployeeService)).As(typeof(IEmployeeService)).InstancePerDependency(); builder.RegisterType(typeof(OfferService)).As(typeof(IOfferService)).InstancePerDependency(); builder.RegisterType(typeof(OrderService)).As(typeof(IOrderService)).InstancePerDependency(); builder.RegisterType(typeof(ProductService)).As(typeof(IProductService)).InstancePerDependency(); builder.RegisterType(typeof(RegionService)).As(typeof(IRegionService)).InstancePerDependency(); builder.RegisterType(typeof(OrderItemService)).As(typeof(IOrderItemService)).InstancePerDependency(); builder.RegisterType(typeof(OfferItemService)).As(typeof(IOfferItemService)).InstancePerDependency(); builder.RegisterType <ApplicationUserManager>().AsSelf().InstancePerRequest(); builder.RegisterType <ApplicationSignInManager>().AsSelf().InstancePerRequest(); builder.Register(c => new UserStore <ApplicationUser>(c.Resolve <ApplicationDbContext>())).AsImplementedInterfaces().InstancePerRequest(); builder.Register(c => new RoleStore <IdentityRole>(c.Resolve <ApplicationDbContext>())).InstancePerRequest(); //builder.RegisterType<ApplicationRoleManager>().AsSelf().InstancePerRequest(); builder.Register(c => HttpContext.Current.GetOwinContext().Authentication).As <IAuthenticationManager>(); builder.Register(c => new IdentityFactoryOptions <ApplicationUserManager> { DataProtectionProvider = new Microsoft.Owin.Security.DataProtection.DpapiDataProtectionProvider("Application") }); // Set the dependency resolver to be Autofac. var container = builder.Build(); DependencyResolver.SetResolver(new AutofacDependencyResolver(container)); }
protected void Application_Start() { EngineContext.Initialize(false); if (DataSettingsHelper.DatabaseIsInstalled()) { TaskManager.Instance.Initialize(); TaskManager.Instance.Start(); } var dependencyResolver = new FaraDependencyResolver(); DependencyResolver.SetResolver(dependencyResolver); ModelBinders.Binders.Add(typeof(BaseFaraModel), new FaraModelBinder()); if (DataSettingsHelper.DatabaseIsInstalled()) { ViewEngines.Engines.Clear(); ViewEngines.Engines.Add(new ThemeableRazorViewEngine()); } ModelMetadataProviders.Current = new FaraMetadataProvider(); AreaRegistration.RegisterAllAreas(); if (DataSettingsHelper.DatabaseIsInstalled() && EngineContext.Current.Resolve <StoreInformationSettings>().DisplayMiniProfilerInPublicStore) { GlobalFilters.Filters.Add(new ProfilingActionFilter()); } RegisterGlobalFilters(GlobalFilters.Filters); RegisterRoutes(RouteTable.Routes); DataAnnotationsModelValidatorProvider.AddImplicitRequiredAttributeForValueTypes = false; ModelValidatorProviders.Providers.Add(new FluentValidationModelValidatorProvider(new FaraValidatorFactory())); var embeddedViewResolver = EngineContext.Current.Resolve <IEmbeddedViewResolver>(); var embeddedProvider = new EmbeddedViewVirtualPathProvider(embeddedViewResolver.GetEmbeddedViews()); HostingEnvironment.RegisterVirtualPathProvider(embeddedProvider); if (DataSettingsHelper.DatabaseIsInstalled()) { if (EngineContext.Current.Resolve <StoreInformationSettings>().MobileDevicesSupported) { HttpCapabilitiesBase.BrowserCapabilitiesProvider = new FiftyOne.Foundation.Mobile.Detection.MobileCapabilitiesProvider(); } else { HttpCapabilitiesBase.BrowserCapabilitiesProvider = null; } } }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); GlobalConfiguration.Configure(WebApiConfig.Register); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); GlobalConfiguration.Configure(WebApiConfig.Register); RouteConfig.RegisterRoutes(RouteTable.Routes); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); //Tip: Want to call the EPiServer API on startup? Add an initialization module instead (Add -> New Item.. -> EPiServer -> Initialization Module) }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); RouteConfig.RegisterRoutes(RouteTable.Routes); ModelBinders.Binders.Add(typeof(Cart), new CartModelBinder()); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); GlobalConfiguration.Configure(WebApiConfig.Register); IocConfig.Register(GlobalConfiguration.Configuration); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); RouteConfig.RegisterRoutes(RouteTable.Routes); GlobalFilters.Filters.Add(new HandleErrorAttribute()); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); GlobalConfiguration.Configure(WebApiConfig.Register); DatabaseConfig.Initialize(); }
protected void Application_Start() { //Code 3 AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); Task task = new Task(() => { while (true) { ATSEntities db = new ATSEntities(); using (db) { var Records = db.DripEmails.Where(x => x.IsScheduled == true && x.ScheduledDateTime <= DateTime.Now && (x.IsSentSuccess == false || x.IsSentSuccess == null)).ToList(); foreach (var item in Records) { //Email Code here try { int canId = (int)item.CandidateId; var candiate = db.Candidates.FirstOrDefault(x => x.CanId == canId); MailMessage mail = new MailMessage(); SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com"); mail.From = new MailAddress("*****@*****.**"); mail.To.Add(candiate.Email);//candidate email mail.Subject = item.Subject; mail.Body = item.EmailBodyText; SmtpServer.Port = 587; SmtpServer.Credentials = new System.Net.NetworkCredential("recruiteragentproject", "newproject"); SmtpServer.EnableSsl = true; SmtpServer.Send(mail); item.IsSentSuccess = true; //Update Record Code db.DripEmails.Attach(item); db.Entry(item).State = EntityState.Modified; db.SaveChanges(); } catch (Exception ex) { ////Update Record Code if error issent=false item update //Update Record Code item.IsSentSuccess = false; db.DripEmails.Attach(item); db.Entry(item).State = EntityState.Modified; db.SaveChanges(); } } } Thread.Sleep(1000); } }); task.Start(); }
void Application_Start() { AreaRegistration.RegisterAllAreas(); RouteConfig.RegisterRoutes(RouteTable.Routes); UnityConfig.RegisterComponents(); }
void Application_Start(object sender, EventArgs e) { // Code that runs on application startup AreaRegistration.RegisterAllAreas(); RouteConfig.RegisterRoutes(RouteTable.Routes); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); }
protected void Application_Start() { // SSL & TLS ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12; ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, errors) => true; // we use our own mobile devices support (".Mobile" is reserved). that's why we disable it. var mobileDisplayMode = DisplayModeProvider.Instance.Modes.FirstOrDefault(x => x.DisplayModeId == DisplayModeProvider.MobileDisplayModeId); if (mobileDisplayMode != null) { DisplayModeProvider.Instance.Modes.Remove(mobileDisplayMode); } bool installed = DataSettings.DatabaseIsInstalled(); if (installed) { // Remove all view engines ViewEngines.Engines.Clear(); } // Initialize engine context var engine = EngineContext.Initialize(false); // Model binders ModelBinders.Binders.DefaultBinder = new SmartModelBinder(); // Add some functionality on top of the default ModelMetadataProvider ModelMetadataProviders.Current = new SmartMetadataProvider(); // Register MVC areas AreaRegistration.RegisterAllAreas(); // Fluent validation InitializeFluentValidator(); // Routes RegisterRoutes(RouteTable.Routes, engine, installed); // localize MVC resources ClientDataTypeModelValidatorProvider.ResourceClassKey = "MvcLocalization"; DefaultModelBinder.ResourceClassKey = "MvcLocalization"; ErrorMessageProvider.SetResourceClassKey("MvcLocalization"); // Register JsEngine RegisterJsEngines(); // VPPs RegisterVirtualPathProviders(); if (installed) { // register our themeable razor view engine we use ViewEngines.Engines.Add(new ThemeableRazorViewEngine()); // Global filters RegisterGlobalFilters(GlobalFilters.Filters, engine); // Bundles RegisterBundles(BundleTable.Bundles, engine); // "throw-away" filter for task scheduler initialization (the filter removes itself when processed) GlobalFilters.Filters.Add(new InitializeSchedulerFilter(), int.MinValue); // register AutoMapper class maps RegisterClassMaps(engine); } else { // app not installed // Install filter GlobalFilters.Filters.Add(new HandleInstallFilter(), -1000); } }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); RouteConfig.RegisterRoutes(RouteTable.Routes); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); RouteConfig.RegisterRoutes(RouteTable.Routes); Database.SetInitializer <EfDbContext>(null); }