Пример #1
0
 public IList <T> GetAll()
 {
     using (var dbContext = new WorkflowContext())
     {
         var dbSet = dbContext.Set <T>();
         return(dbSet.ToList());
     }
 }
Пример #2
0
 public T SaveCommit(T entity)
 {
     using (var dbContext = new WorkflowContext())
     {
         var repository = dbContext.Set <T>();
         repository.Add(entity);
         dbContext.SaveChanges();
     }
     return(entity);
 }
Пример #3
0
 public T Update(T entity)
 {
     using (var dbContext = new WorkflowContext())
     {
         var repository = dbContext.Set <T>();
         repository.Attach(entity);
         dbContext.Entry(entity).State = EntityState.Modified;
         dbContext.SaveChanges();
     }
     return(entity);
 }
 public RepositoryBaseWorkflow(WorkflowContext context)
 {
     Db    = context;
     DbSet = Db.Set <TEntity>();
 }