public ProductManagementContext GetContext()
        {
            var options = new DbContextOptionsBuilder <ProductManagementContext>()
                          .UseInMemoryDatabase(Guid.NewGuid().ToString())
                          .Options;

            _context = new ProductManagementContext(options);
            return(_context);
        }
示例#2
0
        public static void Initialize(IServiceProvider serviceProvider)
        {
            using (var context = new ProductManagementContext(serviceProvider.GetRequiredService <DbContextOptions <ProductManagementContext> >()))
            {
                if (context.Products.Any())
                {
                    return;
                }

                var randomizer = new Random();
                for (int i = 0; i < 10; i++)
                {
                    context.Products.Add(new Product {
                        Id = Guid.NewGuid(), Name = $"Test{i}", Description = $"Test{i} Product", Quantity = randomizer.Next(1, 100), Touched = DateTime.UtcNow
                    });
                    Task.Delay(10);
                }
                context.SaveChanges();
            }
        }
 public GetProductByIdHandler(ProductManagementContext context,
                              IProductMapper productMapper)
 {
     _context       = context;
     _productMapper = productMapper;
 }
示例#4
0
 public UserRepository(ProductManagementContext context)
 {
     productContext = context;
     dbset          = context.Set <Users>();
 }
 public ImageRepository(ProductManagementContext context)
 {
     _context = context;
 }
示例#6
0
 public ProductRepository(ProductManagementContext context)
 {
     this.context = context;
 }
示例#7
0
 public DimensionRepository(ProductManagementContext context)
 {
     _context = context;
 }
 public CategoryQueryFacade(ProductManagementContext context)
 {
     _context = context;
 }
 public ProductQueryFacade(ProductManagementContext context)
 {
     _context = context;
 }
示例#10
0
 public DimensionQueryFacade(ProductManagementContext context)
 {
     _context = context;
 }
 public LeafCategoryRepository(ProductManagementContext context)
 {
     _context = context;
 }
示例#12
0
 protected Repository(ProductManagementContext context)
 {
     Context = context;
     DbSet   = context.Set <TEntity>();
 }
示例#13
0
 public ProductRepository(ProductManagementContext context, IProfitMarginService profitMarginService) : base(context)
 {
     _profitMarginService = profitMarginService;
 }
示例#14
0
 public SpecificationQueryFacade(ProductManagementContext context)
 {
     _context = context;
 }
示例#15
0
 public UpdateProductHandler(ProductManagementContext context,
                             IProductMapper productMapper)
 {
     _context       = context;
     _productMapper = productMapper;
 }
示例#16
0
 public ProductRepository(ProductManagementContext context)
 {
     productContext = context;
     dbset          = context.Set <Products>();
 }
 public SpecificationRepository(ProductManagementContext context)
 {
     _context = context;
 }