static void Main(string[] args) { var configuration = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json") .Build(); string connectionString = configuration.GetConnectionString("store"); DbContextOptions <storeContext> options = new DbContextOptionsBuilder <storeContext>() .UseSqlServer(connectionString) .Options; using var ctx = new storeContext(options); var transaction = ctx.Database.BeginTransaction(); userInterface = new ConsoleUI(); //dataStore = new MemoryDataStore(); dataStore = new DatabaseDataStore(ctx, ref transaction); bool exit = false; while (!exit) { Login(); exit = MainMenu(); } transaction.Dispose(); }
public BuggyController(storeContext context) { _context = context; }
public GenericRepository(storeContext context) { this.context = context; this.dbSet = context.Set <TEntity>(); }