Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
            }
        }