Пример #1
0
        public static IServiceCollection RegisterDalServices(this IServiceCollection services,
                                                             IConfiguration configuration)
        {
            services.AddDbContext <WebsiteManagementDbContext>(options =>
            {
                options.UseSqlServer(configuration["ConnectionStrings:WebsiteManagement"]);
            });

            services.AddSingleton(AutoMapperProfile.GetMapperInstance());

            services.AddTransient <IWebsiteRepository, WebsiteRepository>();
            services.AddTransient <IWebsiteManagementDbContext, WebsiteManagementDbContext>();
            services.AddTransient <IWebsiteManagementEntityMapper, WebsiteManagementEntityMapper>();

            return(services);
        }