public async Task <int> Delete <T>(string propertyName, long propertyValue) where T : class { IEntityType entityType = DbContextExtension.GetEntityType <T>(dbContext); if (entityType != null) { string tableName = entityType.GetTableName(); return(await this.ExecuteBySql(DbContextExtension.DeleteSql(tableName, propertyName, propertyValue))); } return(-1); }
public async Task <int> Delete <T>(long[] keyValue) where T : class { IEntityType entityType = DbContextExtension.GetEntityType <T>(dbContext); if (entityType != null) { string tableName = entityType.GetTableName(); string keyField = "Id"; return(await this.ExecuteBySql(DbContextExtension.DeleteSql(tableName, keyField, keyValue))); } return(-1); }
public async Task <int> ExecuteByProc(string procName, params DbParameter[] dbParameter) { if (dbContextTransaction == null) { return(await dbContext.Database.ExecuteSqlRawAsync(DbContextExtension.BuilderProc(procName, dbParameter), dbParameter)); } else { await dbContext.Database.ExecuteSqlRawAsync(DbContextExtension.BuilderProc(procName, dbParameter), dbParameter); return(dbContextTransaction == null ? await this.CommitTrans() : 0); } }