public async Task <T> Create(T entity)
        {
            EntityEntry dbEntityEntry = employeeDBContext.Entry(entity);
            var         response      = await employeeDBContext.Set <T>().AddAsync(entity);

            await employeeDBContext.SaveChangesAsync();

            return(response.Entity);
        }
Beispiel #2
0
 static void Main(string[] args)
 {
     using (var context = new EmployeeDBContext())
     {
         var result = context.Set<Employee>().Include(x => x.Department).ToArray();
     }
 }
Beispiel #3
0
 public GenericRepository(EmployeeDBContext dbContext)
 {
     _dbContext = dbContext;
     _entities  = _dbContext.Set <TEntities>();
 }
Beispiel #4
0
 public GenericRepository(EmployeeDBContext context)
 {
     dbContext = context;
     table     = dbContext.Set <T>();
 }
Beispiel #5
0
 public GenericRepository()
 {
     dbContext = new EmployeeDBContext();
     table     = dbContext.Set <T>();
 }
 public GenericRepository(EmployeeDBContext context)
 {
     this.context = context;
     this.dbSet   = context.Set <TEntity>();
 }
 public GenericRepository(EmployeeDBContext _context)
 {
     this._context = _context;
     table         = _context.Set <T>();
 }
 public GenericRepository()
 {
     this._context = new EmployeeDBContext();
     table         = _context.Set <T>();
 }
 public Repository(EmployeeDBContext context)
 {
     Context = context;
     Table   = Context.Set <T>();
 }
 public Repository()
 {
     Context = new EmployeeDBContext();
     Table   = Context.Set <T>();
 }
Beispiel #11
0
 public GenericRepository(EmployeeDBContext employeeDBContext)
 {
     EmployeeDBContext = employeeDBContext;
     DBSet             = employeeDBContext.Set <TEntity>();
 }
 public Repository(EmployeeDBContext _context)
 {
     this._context = _context;
     table         = _context.Set <TEntity>();
 }