示例#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());
 }
示例#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));
 }
示例#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);
     }
 }
示例#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);
     }
 }