Interface IDbProvider
Namespace: Tool.SqlCore
Assembly: Tool.Net.dll
SQL数据化的模型接口
public interface IDbProviderExtension Methods
ObjectExtension.Add<T>(object, object, object), ObjectExtension.CopyEntity(object, object, params string[]), ObjectExtension.EntityToJson(object), ObjectExtension.EntityToJson(object, bool), ObjectExtension.EntityToJson(object, bool, string), DictionaryExtension.GetDictionary(object), TypeExtension.GetFieldKey(object, string, out bool), TypeExtension.GetFieldKey<T>(object, string, out bool), TypeExtension.GetFieldKey(object, Type, string, out bool), ObjectExtension.GetIntPtr(object), ObjectExtension.GetIntPtrInt(object), TypeExtension.GetPropertieFind(object, string, bool), TypeExtension.GetProperties(object), TypeExtension.GetPropertyKey(object, string, out bool), TypeExtension.GetPropertyKey<T>(object, string, out bool), TypeExtension.GetPropertyKey(object, Type, string, out bool), TypeExtension.GetValue(object, PropertyDescriptor), TypeExtension.GetValue(object, string, bool), TypeExtension.GetValue(object, string), ObjectExtension.Read<T>(object, object, int, int), ObjectExtension.Read<T>(object, int, object, int, int), DictionaryExtension.SetDictionary(object, IDictionary<string, object>), TypeExtension.SetFieldKey(object, string, object), TypeExtension.SetFieldKey<T>(object, string, object), TypeExtension.SetFieldKey(object, Type, string, object), TypeExtension.SetPropertyKey(object, string, object), TypeExtension.SetPropertyKey<T>(object, string, object), TypeExtension.SetPropertyKey(object, Type, string, object), TypeExtension.SetValue(object, PropertyDescriptor, object), TypeExtension.SetValue(object, string, object, bool), TypeExtension.SetValue(object, string, object), ObjectExtension.ToBase64String(object), ObjectExtension.ToBytes(object), ObjectExtension.ToBytes(object, out Type), DictionaryExtension.ToDictionary(object), DictionaryExtension.ToDictionary<T>(object), DictionaryExtension.ToIDictionary(object), DictionaryExtension.ToIDictionary<T>(object), ObjectExtension.ToJson(object), ObjectExtension.ToJson(object, JsonSerializerOptions), ObjectExtension.ToJsonWeb(object), ObjectExtension.ToJsonWeb(object, Action<JsonSerializerOptions>), ObjectExtension.ToTryVar<T>(object, T), ObjectExtension.ToVar<T>(object), ObjectExtension.ToVar(object, Type, bool), ObjectExtension.ToVar(object, string), ObjectExtension.ToXml(object)
Remarks
代码由逆血提供支持
Properties
ParameterPrefix
参数表示符号 '@' 或 ':'
string ParameterPrefix { get; }Property Value
Methods
DeriveParameters(IDbCommand)
读取存储过程参数填充到 .Parameters 集合(内置实现采用虚构委托,如在意性能请自行实现,示例:DbCommandBuilder.DeriveParameters(cmd) 每个数据库下面都有对应的实现类。)
void DeriveParameters(IDbCommand cmd)Parameters
cmd IDbCommand
数据库对象
GetInsertParams(DbHelper, IDictionary<string, object>, out string, out string)
根据键值对生成 Insert 部分语法,和值添加对象
List<DbParameter> GetInsertParams(DbHelper database, IDictionary<string, object> keyValues, out string key, out string value)Parameters
database DbHelper
数据库引擎
keyValues IDictionary<string, object>
数据集键值对
key string
返回生成的部分SQL语句
value string
返回生成的部分SQL语句
Returns
GetLastIdSql()
获取插入数据的主键ID(SQL)
string GetLastIdSql()Returns
GetPagerSet(DbHelper, PagerParameters)
分页核心方法,建议重写,底层默认实现 SqlServer 分页。
PagerSet GetPagerSet(DbHelper dbHelper, PagerParameters pramsPager)Parameters
dbHelper DbHelper
数据库引擎
pramsPager PagerParameters
分页参数
Returns
返回分页对象实体
GetPagerSetAsync(DbHelper, PagerParameters)
分页核心方法,建议重写,底层默认实现 SqlServer 分页。
Task<PagerSet> GetPagerSetAsync(DbHelper dbHelper, PagerParameters pramsPager)Parameters
dbHelper DbHelper
pramsPager PagerParameters
分页参数
Returns
返回分页对象实体
GetParam(ref DbParameter, object, ParameterDirection, Type, string, int)
绑定数据,需要用户实现,默认不实现,内置采用系统默认类型,满足基本类型的对应
void GetParam(ref DbParameter paraObj, object paraValue, ParameterDirection direction, Type paraType, string sourceColumn, int size)Parameters
paraObj DbParameter
数据库映射对象
paraValue object
值
direction ParameterDirection
指定查询内的有关 的参数的类型。
paraType Type
类型
sourceColumn string
源列
size int
大小
GetUpdateParams(DbHelper, IDictionary<string, object>, out string)
根据键值对生成 Update 部分语法,和值添加对象
List<DbParameter> GetUpdateParams(DbHelper database, IDictionary<string, object> keyValues, out string strsql)Parameters
database DbHelper
数据库引擎
keyValues IDictionary<string, object>
数据集键值对
strsql string
返回生成的部分SQL语句
Returns
Instance(DbProviderType, string)
获取当前对象的实例
DbProviderFactory Instance(DbProviderType dbProviderType, string dbProviderName)Parameters
dbProviderType DbProviderType
数据库类型
dbProviderName string
数据库类型定义名称
Returns
IsBackupDatabase()
无用,返回true
bool IsBackupDatabase()Returns
IsCompactDatabase()
无用,返回true
bool IsCompactDatabase()Returns
IsDbOptimize()
无用,返回true
bool IsDbOptimize()Returns
IsFullTextSearchEnabled()
无用,返回true
bool IsFullTextSearchEnabled()Returns
IsShrinkData()
无用,返回true
bool IsShrinkData()Returns
IsStoreProc()
无用,返回true
bool IsStoreProc()