Esempio n. 1
0
 public static List <T> FromSql <T>(
     this IItsDbContext dataContext,
     string sql,
     params object[] parameters)
     where T : class
 {
     return(dataContext.Set <T>().FromSql(sql, parameters).ToList());
 }
Esempio n. 2
0
 internal static Task <List <T> > FromSqlAsync <T>(
     this IItsDbContext dataContext,
     CancellationToken ctok,
     string sql,
     params object[] parameters)
     where T : class
 {
     return(dataContext.Set <T>().FromSql(sql, parameters).ToListAsync(ctok));
 }
Esempio n. 3
0
 public static bool RemoveEntry <T>(this IItsDbContext dataContext, T exist)
     where T : class
 {
     try
     {
         dataContext.Set <T>().Remove(exist);
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Esempio n. 4
0
 public static bool AddEntry <T>(this IItsDbContext dataContext, T entity)
     where T : class
 {
     try
     {
         dataContext.Set <T>().Add(entity);
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }