Beispiel #1
0
        protected async Task <IList <T> > SelectAllAsync(params Expression <Func <T, object> >[] includes)
        {
            var query = InceptionContext.Set <T>().AsQueryable();

            if (includes != null)
            {
                query = includes.Aggregate(query, (current, include) => current.Include(include));
            }

            return(await query.ToListAsync().ConfigureAwait(false));
        }
Beispiel #2
0
        protected IQueryable <T> SelectAll(params Expression <Func <T, object> >[] includes)
        {
            var query = InceptionContext.Set <T>().AsQueryable();

            if (includes != null)
            {
                query = includes.Aggregate(query, (current, include) => current.Include(include));
            }

            return(query);
        }
Beispiel #3
0
        protected IQueryable <T> Select(Expression <Func <T, bool> > predicate, params Expression <Func <T, object> >[] includes)
        {
            var query = InceptionContext.Set <T>().AsQueryable();

            if (includes != null)
            {
                query = includes.Aggregate(query, (current, include) => current.Include(include));
            }

            query = query.Where(predicate).AsQueryable();

            return(query);
        }
Beispiel #4
0
 public virtual async Task <T> FindByIdAsync(long id)
 {
     return(await InceptionContext.Set <T>().FindAsync(id).ConfigureAwait(false));
 }
Beispiel #5
0
 public virtual async Task <bool> DeleteAsync(T entity)
 {
     InceptionContext.Set <T>().Remove(entity);
     return(await CommitAsync().ConfigureAwait(false) > 0);
 }
Beispiel #6
0
 public virtual async Task <bool> UpdateAsync(T entity)
 {
     InceptionContext.Entry(entity).State = EntityState.Modified;
     return(await CommitAsync().ConfigureAwait(false) > 0);
 }
Beispiel #7
0
 public virtual async Task <bool> InsertAsync(T entidade)
 {
     InceptionContext.Set <T>().Add(entidade);
     return(await CommitAsync().ConfigureAwait(false) > 0);
 }
Beispiel #8
0
 public int Save()
 {
     return(InceptionContext.SaveChanges());
 }
Beispiel #9
0
 public virtual T FindById(long id)
 {
     return(InceptionContext.Set <T>().Find(id));
 }
Beispiel #10
0
 public virtual void Delete(T entity)
 {
     InceptionContext.Set <T>().Remove(entity);
 }
Beispiel #11
0
 public virtual void Update(T entity)
 {
     InceptionContext.Entry(entity).State = EntityState.Modified;
 }
Beispiel #12
0
 public virtual void Insert(T entity)
 {
     InceptionContext.Set <T>().Add(entity);
 }
Beispiel #13
0
 protected BaseRepository(InceptionContext inceptionContext)
 {
     InceptionContext = inceptionContext;
 }
Beispiel #14
0
 private async Task <int> CommitAsync()
 {
     return(await InceptionContext.SaveChangesAsync().ConfigureAwait(false));
 }
Beispiel #15
0
 public virtual async Task <int> SaveAsync()
 {
     return(await InceptionContext.SaveChangesAsync().ConfigureAwait(false));
 }
Beispiel #16
0
 public InceptionsRepository(InceptionContext inceptionContext) : base(inceptionContext)
 {
 }