public static int Commit() { try { return(EFContextFactory.GetCurrentDbContext().SaveChanges()); } catch (Exception ex) { throw new Exception(ex.Message); } }
public int ExcuteSql(string strSql, DbParameter[] parameters) { try { var dbContext = EFContextFactory.GetCurrentDbContext(); return(parameters == null?dbContext.Database.ExecuteSqlCommand(strSql) : EFContextFactory.GetCurrentDbContext().Database.ExecuteSqlCommand(strSql, parameters)); } catch (Exception ex) { throw new Exception("执行SQL语句时发生异常:" + ex.Message); } }