コード例 #1
0
        public static void RegisterServices(IServiceCollection services, string connectionString)
        {
            services.AddDbContext <ShoppingCartDbContext>(options =>
                                                          options.UseSqlServer(connectionString));

            services.AddScoped <IProductsRepository, ProductsRepositorycs>();
            services.AddScoped <IProductService, ProductsService>();

            services.AddScoped <ICategoryRepository, CategoriesRepository>();
            services.AddScoped <ICategoryService, CategoriesService>();


            services.AddScoped <IMembersRepository, MembersRepostory>();
            services.AddScoped <IMembersService, MembersSerivce>();

            services.AddAutoMapper(typeof(AutomapperConfiguration));
            AutomapperConfiguration.RegisterMappings();
        }