private Gallery_dbContext SqlLiteInMemoryContext() { var options = new DbContextOptionsBuilder <Gallery_dbContext>() //.UseSqlite("DataSource=:memory:") .UseSqlServer(@"Data Source=(localdb)\MSSQLLocalDB;Database=MSSQLLocalDB;Integrated Security=True;") .Options; var context = new Gallery_dbContext(options); context.Database.OpenConnection(); context.Database.EnsureCreated(); context.CartItem.AddRange(TestCartItem()); context.CartItemTypes.AddRange(TestCartItemTypes()); context.Country.AddRange(TestCountry()); context.Currency.AddRange(TestCurrency()); context.DeliveryDetails.AddRange(TestDeliveryDetails()); context.DeliveryOption.AddRange(TestDeliveryOption()); context.OrderItem.AddRange(TestOrderItem()); context.OrderStatus.AddRange(TestOrderStatus()); context.OrderTb.AddRange(TestOrderTb()); context.PaymentOption.AddRange(TestPaymentOption()); context.Role.AddRange(TestRole()); context.SellItem.AddRange(TestSellItem()); context.ShoppingCart.AddRange(TestShoppingCart()); context.Users.AddRange(TestUsers()); context.SaveChanges(); return(context); }
private static Gallery_dbContext InMemoryContext() { var options = new DbContextOptionsBuilder <Gallery_dbContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()) .EnableSensitiveDataLogging() .Options; var context = new Gallery_dbContext(options); return(context); }
public BaseEntityDAL(IOptions <AppSettingsModel> settings) { _context = new Gallery_dbContext(settings); }