Example #1
0
 public TEntity First(Expression <Func <TEntity, bool> > predicate)
 {
     using (var Context = new SolrQueryExplainContext())
     {
         return(Context.Set <TEntity>().First(predicate));
     }
 }
Example #2
0
 public TEntity GetById(object id)
 {
     using (var Context = new SolrQueryExplainContext())
     {
         return(Context.Set <TEntity>().Find(id));
     }
 }
Example #3
0
 public TEntity First()
 {
     using (var Context = new SolrQueryExplainContext())
     {
         return(Context.Set <TEntity>().First());
     }
 }
Example #4
0
 public List <TEntity> GetAll()
 {
     using (var Context = new SolrQueryExplainContext())
     {
         return(Context.Set <TEntity>().ToList());
     }
 }
Example #5
0
 public List <TEntity> GetAll(Expression <Func <TEntity, bool> > predicate)
 {
     using (var Context = new SolrQueryExplainContext())
     {
         return(Context.Set <TEntity>()
                .Where(predicate).ToList());
     }
 }
Example #6
0
 public void Insert(TEntity entity)
 {
     using (var Context = new SolrQueryExplainContext())
     {
         Context.Set <TEntity>().Add(entity);
         Context.SaveChanges();
     }
 }
Example #7
0
 public TEntity FirstOrDefault(Expression <Func <TEntity, bool> > predicate, Expression <Func <TEntity, object> > include)
 {
     using (var Context = new SolrQueryExplainContext())
     {
         return(Context.Set <TEntity>()
                .Include(include)
                .FirstOrDefault(predicate));
     }
 }
Example #8
0
 public void Update(TEntity entity)
 {
     using (var Context = new SolrQueryExplainContext())
     {
         Context.Set <TEntity>().Attach(entity);
         Context.Entry(entity).State = EntityState.Modified;
         Context.SaveChanges();
     }
 }
Example #9
0
 public void Delete(TEntity entity)
 {
     using (var Context = new SolrQueryExplainContext())
     {
         if (Context.Entry(entity).State == EntityState.Detached)
         {
             Context.Set <TEntity>().Attach(entity);
         }
         Context.Set <TEntity>().Remove(entity);
         Context.SaveChanges();
     }
 }