Пример #1
0
 protected void Application_Start()
 {
     AreaRegistration.RegisterAllAreas();
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     BundleConfig.RegisterBundles(BundleTable.Bundles);
     AutofacConfigureMVC.RegisterAutofac();
     AutoMapperConfig.ConfigureAtApplicationStart();
 }
 public static void InitializeStartup(IServiceCollection services, Type startup)
 {
     services.AddDbContext <dbTestContext>(opts => opts.UseSqlServer(ConnectionString.GetConnectionString));
     services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
     services.AddAutoMapper(startup);
     AutoMapperConfig.ConfigureAtApplicationStart();
     services.AddScoped(typeof(IRepository <>), typeof(Repository <>));
     services.AddTransient <ICustomerService, CustomerService>();
     //email related services and configuration
     services.AddSingleton <IEmailConfiguration, EmailConfiguration>();
     services.AddTransient <IEmailService, EmailService>();
     services.AddTransient <IContactUsServices, ContactUsServices>();
     services.AddTransient <IGeneratePdf, GeneratePdf>();
     services.AddTransient <IGenerateWord, GenerateWord>();
 }