Exemplo n.º 1
0
        public async Task <int> DeleteAsync <TKey>(TKey id)
        {
            SqlProvider.FormatDelete(id);
            SetSql();
            var result = await ExecAsync(SqlProvider.SqlString, SqlProvider.Params, _dbTransaction);

            return(result);
        }
Exemplo n.º 2
0
        public async Task <int> DeleteAsync(T model)
        {
            SqlProvider.FormatDelete();
            //设置参数
            DynamicParameters param = new DynamicParameters();

            SqlProvider.SqlString = $"{SqlProvider.SqlString} {SqlProvider.GetIdentityWhere(model, param)}";
            return(await DbCon.ExecuteAsync(SqlProvider.SqlString, param, isExcludeUnitOfWork : SqlProvider.IsExcludeUnitOfWork));
        }
Exemplo n.º 3
0
        public int Delete(T model)
        {
            SqlProvider.FormatDelete();
            var entityObject = EntityCache.QueryEntity(model.GetType());
            var identity     = entityObject.EntityFieldList.FirstOrDefault(x => x.IsIdentity);

            if (identity == null)
            {
                throw new System.Exception("主键不存在!");
            }
            //设置参数
            DynamicParameters param = new DynamicParameters();

            param.Add(entityObject.Identitys, identity.PropertyInfo.GetValue(model));
            return(DbCon.Execute($@"{SqlProvider.SqlString} AND {entityObject.Identitys}={SqlProvider.ProviderOption.ParameterPrefix}{entityObject.Identitys}
			"            , param));
        }
Exemplo n.º 4
0
 public int Delete()
 {
     SqlProvider.FormatDelete();
     return(DbCon.Execute(SqlProvider.SqlString, SqlProvider.Params, DbTransaction));
 }
Exemplo n.º 5
0
        public async Task <int> DeleteAsync()
        {
            SqlProvider.FormatDelete();

            return(await DbCon.ExecuteAsync(SqlProvider.SqlString, SqlProvider.Params, DbTransaction));
        }
Exemplo n.º 6
0
 public int Delete <TKey>(TKey id)
 {
     SqlProvider.FormatDelete(id);
     SetSql();
     return(Exec(SqlProvider.SqlString, SqlProvider.Params, _dbTransaction));
 }
Exemplo n.º 7
0
 public async Task <int> DeleteAsync()
 {
     SqlProvider.FormatDelete();
     return(await DbCon.ExecuteAsync(SqlProvider.SqlString, SqlProvider.Params, DbTransaction, isExcludeUnitOfWork : SqlProvider.IsExcludeUnitOfWork));
 }
Exemplo n.º 8
0
 public int Delete()
 {
     SqlProvider.FormatDelete();
     return(DbCon.Execute(SqlProvider.SqlString, SqlProvider.Params, DbTransaction, isExcludeUnitOfWork: SqlProvider.IsExcludeUnitOfWork));
 }