public async Task <IEnumerable <T> > GetAll() { await using var context = _contextFactory.CreateDbContext(new[] { "" }); var list = await context.Set <T>().ToListAsync(); return(list); }
public async Task <IEnumerable <T> > GetAll() { using (SimpleTraderDbContext context = _contextFactory.CreateDbContext()) { return(await context.Set <T>().ToListAsync()); } }
public async Task <IEnumerable <Account> > GetAll() { using (SimpleTraderDbContext context = _contextFactory.CreateDbContext()) { IEnumerable <Account> entities = await context.Accounts.Include(a => a.AssetTransactions).ToListAsync(); return(entities); } }
public async Task <T> Get(int id) { using (SimpleTraderDbContext context = _contextFactory.CreateDbContext()) { T entity = await context.Set <T>().FirstOrDefaultAsync((e) => e.Id == id); return(entity); } }
public async Task <T> Create(T entity) { using SimpleTraderDbContext context = _contextFactory.CreateDbContext(); EntityEntry <T> createdResult = await context.Set <T>().AddAsync(entity); await context.SaveChangesAsync(); return(createdResult.Entity); }
public async Task <IEnumerable <T> > GetAll() { using (SimpleTraderDbContext context = _context.CreateDbContext()) { IEnumerable <T> entities = await context.Set <T>().ToListAsync(); return(entities); } }
public async Task <Account> Get(int id) { using (SimpleTraderDbContext context = _contextFactory.CreateDbContext()) { Account entity = await context.Accounts.Include(a => a.AssetTransactions).FirstOrDefaultAsync((e) => e.Id == id); return(entity); } }
public async Task <T> Create(T entity) { await using var context = _contextFactory.CreateDbContext(new[] { "" }); var createdEntity = await context.Set <T>().AddAsync(entity); await context.SaveChangesAsync(); return(createdEntity.Entity); }
public async Task <IEnumerable <T> > GetAll() { using (var context = _contextFactory.CreateDbContext()) { IEnumerable <T> entities = await context.Set <T>().ToListAsync(); return(entities); } }
public async Task <IEnumerable <Account> > GetAll() { await using var context = _contextFactory.CreateDbContext(new[] { "" }); var list = await context.Accounts .Include(x => x.AccountHolder) .Include(x => x.AssetTransactions).Include(x => x.AccountHolder) .ToListAsync(); return(list); }
public async Task <T> Create(T entity) { using (SimpleTraderDbContext context = _contextFactory.CreateDbContext()) { var createdEntity = await context.Set <T>().AddAsync(entity); await context.SaveChangesAsync(); return(createdEntity.Entity); } }
public async Task <T> Create(T entity) { using (var context = _contextFactory.CreateDbContext()) { EntityEntry <T> createEntity = await context.Set <T>().AddAsync(entity); await context.SaveChangesAsync(); return(createEntity.Entity); } }
protected override void OnStartup(StartupEventArgs e) { _host.Start(); SimpleTraderDbContextFactory contextFactory = _host.Services.GetRequiredService <SimpleTraderDbContextFactory>(); using (SimpleTraderDbContext context = contextFactory.CreateDbContext()) { context.Database.Migrate(); } Window window = _host.Services.GetRequiredService <MainWindow>(); window.Show(); base.OnStartup(e); }