diff --git a/FreeSql.Tests/UnitTest1.cs b/FreeSql.Tests/UnitTest1.cs index 821b366d..6df4e361 100644 --- a/FreeSql.Tests/UnitTest1.cs +++ b/FreeSql.Tests/UnitTest1.cs @@ -96,7 +96,6 @@ namespace FreeSql.Tests { //testddd.Persistent().Wait(); g.sqlite.GetRepository().Insert(testddd); - var testpid1 = g.mysql.Insert().AppendData(new TestTypeInfo { Name = "Name" + DateTime.Now.ToString("yyyyMMddHHmmss") }).ExecuteIdentity(); g.mysql.Insert().AppendData(new TestInfo { Title = "Title" + DateTime.Now.ToString("yyyyMMddHHmmss"), CreateTime = DateTime.Now, TypeGuid = (int)testpid1 }).ExecuteAffrows(); diff --git a/FreeSql/DataAnnotations/ColumnFluent.cs b/FreeSql/DataAnnotations/ColumnFluent.cs index 3fcd5553..8fa9c6dc 100644 --- a/FreeSql/DataAnnotations/ColumnFluent.cs +++ b/FreeSql/DataAnnotations/ColumnFluent.cs @@ -37,6 +37,7 @@ namespace FreeSql.DataAnnotations { _column.IsPrimary = value; return this; } + /// /// 自增标识 /// public ColumnFluent IsIdentity(bool value) { diff --git a/FreeSql/Extensions/EntityUtilExtensions.cs b/FreeSql/Extensions/EntityUtilExtensions.cs index 66f769bf..94c403b5 100644 --- a/FreeSql/Extensions/EntityUtilExtensions.cs +++ b/FreeSql/Extensions/EntityUtilExtensions.cs @@ -9,19 +9,20 @@ using System.Text; namespace FreeSql.Extensions.EntityUtil { public static class EntityUtilExtensions { - static MethodInfo MethodStringBuilderAppend = typeof(StringBuilder).GetMethod("Append", new Type[] { typeof(object) }); - static MethodInfo MethodStringBuilderToString = typeof(StringBuilder).GetMethod("ToString", new Type[0]); - static PropertyInfo MethodStringBuilderLength = typeof(StringBuilder).GetProperty("Length"); - static MethodInfo MethodStringConcat = typeof(string).GetMethod("Concat", new Type[] { typeof(object) }); - static MethodInfo MethodFreeUtilNewMongodbId = typeof(FreeUtil).GetMethod("NewMongodbId"); + static readonly MethodInfo MethodStringBuilderAppend = typeof(StringBuilder).GetMethod("Append", new Type[] { typeof(object) }); + static readonly MethodInfo MethodStringBuilderToString = typeof(StringBuilder).GetMethod("ToString", new Type[0]); + static readonly PropertyInfo MethodStringBuilderLength = typeof(StringBuilder).GetProperty("Length"); + static readonly MethodInfo MethodStringConcat = typeof(string).GetMethod("Concat", new Type[] { typeof(object) }); + static readonly MethodInfo MethodFreeUtilNewMongodbId = typeof(FreeUtil).GetMethod("NewMongodbId"); static ConcurrentDictionary>> _dicGetEntityKeyString = new ConcurrentDictionary>>(); /// /// 获取实体的主键值,以 "*|_,[,_|*" 分割,当任意一个主键属性无值时(当Guid无值时,会生成有序的新值),返回 null /// - /// - /// + /// + /// /// + /// /// //public static string GetEntityKeyString(this IFreeSql orm, TEntity entity, string splitString = "*|_,[,_|*") => GetEntityKeyString(orm, typeof(TEntity), entity, splitString); public static string GetEntityKeyString(this IFreeSql orm, Type entityType, object entity, string splitString = "*|_,[,_|*") { @@ -126,8 +127,8 @@ namespace FreeSql.Extensions.EntityUtil { /// /// 获取实体的主键值,多个主键返回数组 /// - /// - /// + /// + /// /// /// //public static object[] GetEntityKeyValues(this IFreeSql orm, TEntity entity) => GetEntityKeyValues(orm, typeof(TEntity), entity); @@ -165,9 +166,10 @@ namespace FreeSql.Extensions.EntityUtil { /// /// 获取实体的属性值 /// - /// - /// + /// + /// /// + /// /// //public static object GetEntityValueWithPropertyName(this IFreeSql orm, TEntity entity, string propertyName) => GetEntityKeyValues(orm, typeof(TEntity), entity, propertyName); public static object GetEntityValueWithPropertyName(this IFreeSql orm, Type entityType, object entity, string propertyName) { @@ -202,8 +204,8 @@ namespace FreeSql.Extensions.EntityUtil { /// /// 获取实体的所有数据,以 (1, 2, xxx) 的形式 /// - /// - /// + /// + /// /// /// //public static string GetEntityString(this IFreeSql orm, TEntity entity) => GetEntityString(orm, typeof(TEntity), entity); @@ -321,8 +323,8 @@ namespace FreeSql.Extensions.EntityUtil { /// /// 设置实体中主键内的自增字段值(若存在) /// - /// /// + /// /// /// //public static void SetEntityIdentityValueWithPrimary(this IFreeSql orm, TEntity entity, long idtval) => SetEntityIdentityValueWithPrimary(orm, typeof(TEntity), entity, idtval); @@ -355,8 +357,8 @@ namespace FreeSql.Extensions.EntityUtil { /// /// 获取实体中主键内的自增字段值(若存在) /// - /// /// + /// /// //public static long GetEntityIdentityValueWithPrimary(this IFreeSql orm, TEntity entity) => GetEntityIdentityValueWithPrimary(orm, typeof(TEntity), entity); public static long GetEntityIdentityValueWithPrimary(this IFreeSql orm, Type entityType, object entity) { @@ -402,8 +404,8 @@ namespace FreeSql.Extensions.EntityUtil { /// /// 清除实体的主键值,将自增、Guid类型的主键值清除 /// - /// /// + /// /// //public static void ClearEntityPrimaryValueWithIdentityAndGuid(this IFreeSql orm, TEntity entity) => ClearEntityPrimaryValueWithIdentityAndGuid(orm, typeof(TEntity), entity); public static void ClearEntityPrimaryValueWithIdentityAndGuid(this IFreeSql orm, Type entityType, object entity) { @@ -446,8 +448,8 @@ namespace FreeSql.Extensions.EntityUtil { /// /// 清除实体的主键值,将自增、Guid类型的主键值清除 /// - /// /// + /// /// //public static void ClearEntityPrimaryValueWithIdentity(this IFreeSql orm, TEntity entity) => ClearEntityPrimaryValueWithIdentity(orm, typeof(TEntity), entity); public static void ClearEntityPrimaryValueWithIdentity(this IFreeSql orm, Type entityType, object entity) { @@ -480,10 +482,11 @@ namespace FreeSql.Extensions.EntityUtil { /// /// 对比两个实体值,返回相同/或不相同的列名 /// - /// /// + /// /// /// + /// /// //public static string[] CompareEntityValueReturnColumns(this IFreeSql orm, TEntity entity1, TEntity entity2, bool isEqual) => CompareEntityValueReturnColumns(orm, typeof(TEntity), entity1, entity2, isEqual); public static string[] CompareEntityValueReturnColumns(this IFreeSql orm, Type entityType, object entity1, object entity2, bool isEqual) { @@ -534,11 +537,11 @@ namespace FreeSql.Extensions.EntityUtil { /// /// 设置实体中某属性的数值增加指定的值 /// - /// /// + /// /// /// - /// + /// //public static void SetEntityIncrByWithPropertyName(this IFreeSql orm, TEntity entity, string propertyName, int incrBy) => SetEntityIncrByWithPropertyName(orm, typeof(TEntity), entity, propertyName, incrBy); public static void SetEntityIncrByWithPropertyName(this IFreeSql orm, Type entityType, object entity, string propertyName, int incrBy) { if (entity == null) return; @@ -576,8 +579,8 @@ namespace FreeSql.Extensions.EntityUtil { /// /// 设置实体中某属性的值 /// - /// /// + /// /// /// /// diff --git a/FreeSql/Extensions/FreeSqlGlobalExtensions.cs b/FreeSql/Extensions/FreeSqlGlobalExtensions.cs index 39a52744..40b44ad8 100644 --- a/FreeSql/Extensions/FreeSqlGlobalExtensions.cs +++ b/FreeSql/Extensions/FreeSqlGlobalExtensions.cs @@ -76,7 +76,7 @@ public static class FreeSqlGlobalExtensions { } /// - /// 将 IEnumable 转成 ISelect,以便使用 FreeSql 的查询功能。此方法用于 Lambad 表达式中,快速进行集合导航的查询。 + /// 将 IEnumable<T> 转成 ISelect<T>,以便使用 FreeSql 的查询功能。此方法用于 Lambad 表达式中,快速进行集合导航的查询。 /// /// /// diff --git a/FreeSql/FreeSql.csproj b/FreeSql/FreeSql.csproj index 9a34bc3e..7c0f8919 100644 --- a/FreeSql/FreeSql.csproj +++ b/FreeSql/FreeSql.csproj @@ -2,7 +2,7 @@ netstandard2.0 - 0.5.6 + 0.5.7 true YeXiangQin FreeSql is the most convenient ORM in dotnet. It supports Mysql, Postgresql, SqlServer, Oracle and Sqlite. @@ -21,6 +21,11 @@ true + + C:\Users\28810\Desktop\github\FreeSql\FreeSql\FreeSql.xml + 3 + + diff --git a/FreeSql/FreeSql.xml b/FreeSql/FreeSql.xml new file mode 100644 index 00000000..0a5b20d3 --- /dev/null +++ b/FreeSql/FreeSql.xml @@ -0,0 +1,2431 @@ + + + + FreeSql + + + + + 数据库列名 + + + + + 指定数据库旧的列名,修改实体属性命名时,同时设置此参数为修改之前的值,CodeFirst才可以正确修改数据库字段;否则将视为【新增字段】 + + + + + 数据库类型,如: varchar(255) + + + + + 主键 + + + + + 自增标识 + + + + + 是否可DBNull + + + + + 忽略此列,不迁移、不插入 + + + + + 设置行锁(乐观锁)版本号,每次更新累加版本号,若更新整个实体时会附带当前的版本号判断(修改失败时抛出异常) + + + + + 唯一键,多个属性指定相同的标识,代表联合键 + + + + + 数据库默认值 + + + + + 类型映射,比如:可将 enum 属性映射成 typeof(string) + + + + + 数据库列名 + + + + + 指定数据库旧的列名,修改实体属性命名时,同时设置此参数为修改之前的值,CodeFirst才可以正确修改数据库字段;否则将视为【新增字段】 + + + + + 数据库类型,如: varchar(255) + + + + + 主键 + + + + + 自增标识 + + + + + 是否可DBNull + + + + + 忽略此列,不迁移、不插入 + + + + + 乐观锁 + + + + + 唯一键,多个属性指定相同的标识,代表联合键 + + 标识 + + + + + 类型映射,比如:可将 enum 属性映射成 typeof(string) + + + + + + + 数据库表名 + + + + + 指定数据库旧的表名,修改实体命名时,同时设置此参数为修改之前的值,CodeFirst才可以正确修改数据库表;否则将视为【创建新表】 + + + + + 查询过滤SQL,实现类似 a.IsDeleted = 1 功能 + + + + + 数据库表名 + + + + + 指定数据库旧的表名,修改实体命名时,同时设置此参数为修改之前的值,CodeFirst才可以正确修改数据库表;否则将视为【创建新表】 + + + + + 查询过滤SQL,实现类似 a.IsDeleted = 1 功能 + + + + + 数据库表名 + + + + + 指定数据库旧的表名,修改实体命名时,同时设置此参数为修改之前的值,CodeFirst才可以正确修改数据库表;否则将视为【创建新表】 + + + + + 查询过滤SQL,实现类似 a.IsDeleted = 1 功能 + + + + + 所属表 + + + + + 列名 + + + + + 映射到 C# 类型 + + + + + 数据库枚举类型int值 + + + + + 数据库类型,字符串,varchar + + + + + 数据库类型,字符串,varchar(255) + + + + + 最大长度 + + + + + 主键 + + + + + 自增标识 + + + + + 是否可DBNull + + + + + 备注 + + + + + 枚举类型标识 + + + + + 枚举项 + + + + + 唯一标识 + + + + + SqlServer下是Owner、PostgreSQL下是Schema、MySql下是数据库名 + + + + + 表名 + + + + + 表备注,SqlServer下是扩展属性 MS_Description + + + + + 表/视图 + + + + + 列 + + + + + 自增列 + + + + + 主键/组合 + + + + + 唯一键/组合 + + + + + 索引/组合 + + + + + 外键 + + + + + 类型标识 + + + + + 枚举项 + + + + + 获取实体的主键值,以 "*|_,[,_|*" 分割,当任意一个主键属性无值时(当Guid无值时,会生成有序的新值),返回 null + + + + + + + + + + 获取实体的主键值,多个主键返回数组 + + + + + + + + + 获取实体的属性值 + + + + + + + + + + 获取实体的所有数据,以 (1, 2, xxx) 的形式 + + + + + + + + + 使用新实体的值,复盖旧实体的值 + + + + + 使用新实体的主键值,复盖旧实体的主键值 + + + + + 设置实体中主键内的自增字段值(若存在) + + + + + + + + + 获取实体中主键内的自增字段值(若存在) + + + + + + + + 清除实体的主键值,将自增、Guid类型的主键值清除 + + + + + + + + 清除实体的主键值,将自增、Guid类型的主键值清除 + + + + + + + + 对比两个实体值,返回相同/或不相同的列名 + + + + + + + + + + + 设置实体中某属性的数值增加指定的值 + + + + + + + + + + 设置实体中某属性的值 + + + + + + + + + + 缓存执行 IUpdate.Set + + + + + + + + + 使用缓存,不指定默认使用内存 + + 缓存实现 + + + + + 使用日志,不指定默认输出控制台 + + + + + + + 使用连接串 + + 数据库类型 + 数据库连接串 + + + + + 使用从数据库,支持多个 + + 从数据库连接串 + + + + + 【开发环境必备】自动同步实体结构到数据库,程序运行中检查实体表是否存在,然后创建或修改 + + true:运行时检查自动同步结构, false:不同步结构 + + + + + 转小写同步结构 + + true:转小写, false:不转 + + + + + 转大写同步结构 + + true:转大写, false:不转 + + + + + 使用数据库的主键和自增,适用 DbFirst 模式,无须在实体类型上设置 [Column(IsPrimary)] 或者 ConfigEntity。此功能目前可用于 mysql/sqlserver/postgresql。 + + + + + + + 不使用命令参数化执行,针对 Insert/Update,也可临时使用 IInsert/IUpdate.NoneParameter() + + + + + + + 延时加载导航属性对象,导航属性需要声明 virtual + + + + + + + 监视数据库命令对象 + + 执行前 + 执行后,可监视执行性能 + + + + + + + 返回内容 + 渲染对象 + 当前文件路径 + + + + + + 指定事务对象 + + + + + + + 指定事务对象 + + + + + + + lambda表达式条件,仅支持实体基础成员(不包含导航对象) + + lambda表达式条件 + + + + + 原生sql语法条件,Where("id = ?id", new { id = 1 }) + + sql语法条件 + 参数 + + + + + 传入实体,将主键作为条件 + + 实体 + + + + + 传入实体集合,将主键作为条件 + + 实体集合 + + + + + 子查询是否存在 + + + 子查询 + 不存在 + + + + + 传入动态对象如:主键值 | new[]{主键值1,主键值2} | TEntity1 | new[]{TEntity1,TEntity2} | new{id=1} + + 主键值、主键值集合、实体、实体集合、匿名对象、匿名对象集合 + + + + + 设置表名规则,可用于分库/分表,参数1:默认表名;返回值:新表名; + + + + + + + 动态Type,在使用 Delete<object> 后使用本方法,指定实体类型 + + + + + + + 返回即将执行的SQL语句 + + + + + + 执行SQL语句,返回影响的行数 + + + + + + 执行SQL语句,返回被删除的记录 + + + + + + 指定事务对象 + + + + + + + 指定事务对象 + + + + + + + 追加准备插入的实体 + + 实体 + + + + + 追加准备插入的实体 + + 实体 + + + + + 追加准备插入的实体集合 + + 实体集合 + + + + + 只插入的列,InsertColumns(a => a.Name) | InsertColumns(a => new{a.Name,a.Time}) | InsertColumns(a => new[]{"name","time"}) + + lambda选择列 + + + + + 忽略的列,IgnoreColumns(a => a.Name) | IgnoreColumns(a => new{a.Name,a.Time}) | IgnoreColumns(a => new[]{"name","time"}) + + lambda选择列 + + + + + 不使用参数化,可通过 IFreeSql.CodeFirst.IsNotCommandParameter 全局性设置 + + + + + + 设置表名规则,可用于分库/分表,参数1:默认表名;返回值:新表名; + + + + + + + 动态Type,在使用 Insert<object> 后使用本方法,指定实体类型 + + + + + + + 返回即将执行的SQL语句 + + + + + + 执行SQL语句,返回影响的行数 + + + + + + 执行SQL语句,返回自增值 + + + + + + 执行SQL语句,返回插入后的记录 + + + + + + 指定事务对象 + + + + + + + 指定连接对象 + + + + + + + 审核或跟踪 ToList 即将返回的数据 + + + + + + + 执行SQL查询,返回 DataTable + + + + + + 执行SQL查询,返回 T1 实体所有字段的记录,记录不存在时返回 Count 为 0 的列表 + + false: 返回 2级 LeftJoin/InnerJoin/RightJoin 对象;true: 返回所有 LeftJoin/InnerJoin/RightJoin 的导航数据 + + + + + 执行SQL查询,返回 field 指定字段的记录,并以元组或基础类型(int,string,long)接收,记录不存在时返回 Count 为 0 的列表 + + + + + + + + 执行SQL查询,返回 T1 实体所有字段的第一条记录,记录不存在时返回 null + + + + + + 执行SQL查询,返回 T1 实体所有字段的第一条记录,记录不存在时返回 null + + + + + + 设置表名规则,可用于分库/分表,参数1:实体类型;参数2:默认表名;返回值:新表名; + + + + + + + 动态Type,在使用 Select<object> 后使用本方法,指定实体类型 + + + + + + + 返回即将执行的SQL语句 + + 指定字段 + + + + + 执行SQL查询,是否有记录 + + + + + + 查询的记录数量 + + + + + + 查询的记录数量,以参数out形式返回 + + 返回的变量 + + + + + 指定从主库查询(默认查询从库) + + + + + + 缓存查询结果 + + 缓存秒数 + 缓存key + + + + + 左联查询,使用导航属性自动生成SQL + + 表达式 + + + + + 联接查询,使用导航属性自动生成SQL + + 表达式 + + + + + 右联查询,使用导航属性自动生成SQL + + 表达式 + + + + + 左联查询,指定关联的实体类型 + + 关联的实体类型 + 表达式 + + + + + 联接查询,指定关联的实体类型 + + 关联的实体类型 + 表达式 + + + + + 右联查询,指定关联的实体类型 + + 关联的实体类型 + 表达式 + + + + + 左联查询,使用原生sql语法,LeftJoin("type b on b.id = a.id and b.clicks > ?clicks", new { clicks = 1 }) + + sql语法条件 + 参数 + + + + + 联接查询,使用原生sql语法,InnerJoin("type b on b.id = a.id and b.clicks > ?clicks", new { clicks = 1 }) + + sql语法条件 + 参数 + + + + + 右联查询,使用原生sql语法,RightJoin("type b on b.id = a.id and b.clicks > ?clicks", new { clicks = 1 }) + + sql语法条件 + 参数 + + + + + 原生sql语法条件,Where("id = ?id", new { id = 1 }) + + sql语法条件 + 参数 + + + + + 原生sql语法条件,WhereIf(true, "id = ?id", new { id = 1 }) + + true 时生效 + sql语法条件 + 参数 + + + + + 按原生sql语法分组,GroupBy("concat(name, ?cc)", new { cc = 1 }) + + sql语法 + 参数 + + + + + 按原生sql语法聚合条件过滤,Having("count(name) = ?cc", new { cc = 1 }) + + sql语法条件 + 参数 + + + + + 按原生sql语法排序,OrderBy("count(name) + ?cc", new { cc = 1 }) + + sql语法 + 参数 + + + + + 查询向后偏移行数 + + + + + + + 查询向后偏移行数 + + 行数 + + + + + 查询多少条数据 + + + + + + + 查询多少条数据 + + + + + + + 分页 + + 第几页 + 每页多少 + + + + + 查询数据前,去重 + + + + + + 执行SQL查询,是否有记录 + + lambda表达式 + + + + + 执行SQL查询,返回 DataTable + + + + + + 执行SQL查询,返回指定字段的记录,记录不存在时返回 Count 为 0 的列表 + + 返回类型 + 选择列 + + + + + 执行SQL查询,返回指定字段的记录的第一条记录,记录不存在时返回 TReturn 默认值 + + 返回类型 + 选择列 + + + + + 执行SQL查询,返回指定字段的记录的第一条记录,记录不存在时返回 TReturn 默认值 + + 返回类型 + 选择列 + + + + + 返回即将执行的SQL语句 + + 返回类型 + 选择列 + + + + + 执行SQL查询,返回指定字段的聚合结果 + + + + + + + + 求和 + + 返回类型 + 列 + + + + + 最小值 + + 返回类型 + 列 + + + + + 最大值 + + 返回类型 + 列 + + + + + 平均值 + + 返回类型 + 列 + + + + + 指定别名 + + 别名 + + + + + 多表查询 + + + + + + + + 多表查询 + + + + + + + + + 多表查询 + + + + + + + + + + 多表查询 + + + + + + + + + + + 多表查询 + + + + + + + + + + + + 多表查询 + + + + + + + + + + + + + 多表查询 + + + + + + + + + + + + + + 多表查询 + + + + + + + + + + + + + + + 多表查询 + + + + + + + + + + + + + + + + 查询条件,Where(a => a.Id > 10),支持导航对象查询,Where(a => a.Author.Email == "2881099@qq.com") + + lambda表达式 + + + + + 查询条件,Where(true, a => a.Id > 10),支导航对象查询,Where(true, a => a.Author.Email == "2881099@qq.com") + + true 时生效 + lambda表达式 + + + + + 多表条件查询 + + + lambda表达式 + + + + + 多表条件查询 + + + lambda表达式 + + + + + 多表条件查询 + + + + lambda表达式 + + + + + 多表条件查询 + + + + + lambda表达式 + + + + + 多表条件查询 + + + + + lambda表达式 + + + + + 传入动态对象如:主键值 | new[]{主键值1,主键值2} | TEntity1 | new[]{TEntity1,TEntity2} | new{id=1} + + 主键值、主键值集合、实体、实体集合、匿名对象、匿名对象集合 + + + + + 按选择的列分组,GroupBy(a => a.Name) | GroupBy(a => new{a.Name,a.Time}) + + + + + + + 按列排序,OrderBy(a => a.Time) + + + + + + + + 按列倒向排序,OrderByDescending(a => a.Time) + + 列 + + + + + 查询条件,Where(a => a.Id > 10),支持导航对象查询,Where(a => a.Author.Email == "2881099@qq.com") + + lambda表达式 + + + + + 查询条件,Where(true, a => a.Id > 10),支导航对象查询,Where(true, a => a.Author.Email == "2881099@qq.com") + + true 时生效 + lambda表达式 + + + + + 按列排序,OrderBy(a => a.Time) + + + + + + + + 按列倒向排序,OrderByDescending(a => a.Time) + + 列 + + + + + 按聚合条件过滤,Where(a => a.Count() > 10) + + lambda表达式 + + + + + 按列排序,OrderBy(a => a.Time) + + + + + + + + 按列倒向排序,OrderByDescending(a => a.Time) + + 列 + + + + + 执行SQL查询,返回指定字段的记录,记录不存在时返回 Count 为 0 的列表 + + 返回类型 + 选择列 + + + + + 返回即将执行的SQL语句 + + 返回类型 + 选择列 + + + + + 查询向后偏移行数 + + + + + + + 查询向后偏移行数 + + 行数 + + + + + 查询多少条数据 + + + + + + + 查询多少条数据 + + + + + + + 分页 + + 第几页 + 每页多少 + + + + + 分组的数据 + + + + + 记录总数 + + + + + + 求和 + + + + + + + + 平均值 + + + + + + + + 最大值 + + + + + + + + 最小值 + + + + + + + 所有元素 + + + + + 指定事务对象 + + + + + + + 指定事务对象 + + + + + + + 不使用参数化,可通过 IFreeSql.CodeFirst.IsNotCommandParameter 全局性设置 + + + + + + 更新数据,设置更新的实体 + + 实体 + + + + + 更新数据,设置更新的实体集合 + + 实体集合 + + + + + 忽略的列,IgnoreColumns(a => a.Name) | IgnoreColumns(a => new{a.Name,a.Time}) | IgnoreColumns(a => new[]{"name","time"}) + + lambda选择列 + + + + + 忽略的列 + + + + + + + 指定的列,UpdateColumns(a => a.Name) | UpdateColumns(a => new{a.Name,a.Time}) | UpdateColumns(a => new[]{"name","time"}) + + lambda选择列 + + + + + 指定的列 + + + + + + + 设置列的新值,Set(a => a.Name, "newvalue") + + + lambda选择列 + 新值 + + + + + 设置列的的新值为基础上增加,格式:Set(a => a.Clicks + 1) 相当于 clicks=clicks+1 + + + + + + + + 设置值,自定义SQL语法,SetRaw("title = ?title", new { title = "newtitle" }) + + sql语法 + 参数 + + + + + lambda表达式条件,仅支持实体基础成员(不包含导航对象) + + lambda表达式条件 + + + + + 原生sql语法条件,Where("id = ?id", new { id = 1 }) + + sql语法条件 + 参数 + + + + + 传入实体,将主键作为条件 + + 实体 + + + + + 传入实体集合,将主键作为条件 + + 实体集合 + + + + + 子查询是否存在 + + + 子查询 + 不存在 + + + + + 传入动态对象如:主键值 | new[]{主键值1,主键值2} | TEntity1 | new[]{TEntity1,TEntity2} | new{id=1} + + 主键值、主键值集合、实体、实体集合、匿名对象、匿名对象集合 + + + + + 设置表名规则,可用于分库/分表,参数1:默认表名;返回值:新表名; + + + + + + + 动态Type,在使用 Update<object> 后使用本方法,指定实体类型 + + + + + + + 返回即将执行的SQL语句 + + + + + + 执行SQL语句,返回影响的行数 + + + + + + 执行SQL语句,返回更新后的记录 + + + + + + 主库连接池 + + + + + 从库连接池 + + + + + 监视数据库命令对象(执行前,调试) + + + + + 监视数据库命令对象(执行后,用于监视执行性能) + + + + + 数据库类型 + + + + + 开启事务(不支持异步),60秒未执行完将自动提交 + + 事务体 () => {} + + + + 开启事务(不支持异步) + + 事务体 () => {} + 超时,未执行完将自动提交 + + + + 当前线程的事务 + + + + + 事务完成前预删除缓存 + + + + + + 查询,若使用读写分离,查询【从库】条件cmdText.StartsWith("SELECT "),否则查询【主库】 + + + + + + + + + 查询,ExecuteReader(dr => {}, "select * from user where age > @age", new { age = 25 }) + + + + + + + 查询 + + + + + + + 查询,ExecuteArray("select * from user where age > @age", new { age = 25 }) + + + + + + + + 查询 + + + + + + + 查询,ExecuteDataSet("select * from user where age > @age; select 2", new { age = 25 }) + + + + + + + + 查询 + + + + + + + 查询,ExecuteDataTable("select * from user where age > @age", new { age = 25 }) + + + + + + + + 在【主库】执行 + + + + + + + + 在【主库】执行,ExecuteNonQuery("delete from user where age > @age", new { age = 25 }) + + + + + + + + 在【主库】执行 + + + + + + + + 在【主库】执行,ExecuteScalar("select 1 from user where age > @age", new { age = 25 }) + + + + + + + + 执行SQL返回对象集合,Query<User>("select * from user where age > @age", new SqlParameter { ParameterName = "age", Value = 25 }) + + + + + + + + + + 执行SQL返回对象集合,Query<User>("select * from user where age > @age", new { age = 25 }) + + + + + + + + + 执行SQL返回对象集合,Query<User>("select * from user where age > @age; select * from address", new SqlParameter { ParameterName = "age", Value = 25 }) + + + + + + + + + + 执行SQL返回对象集合,Query<User>("select * from user where age > @age; select * from address", new { age = 25 }) + + + + + + + + + 查询,若使用读写分离,查询【从库】条件cmdText.StartsWith("SELECT "),否则查询【主库】 + + + + + + + + + 查询,ExecuteReaderAsync(dr => {}, "select * from user where age > @age", new { age = 25 }) + + + + + + + 查询 + + + + + + + 查询,ExecuteArrayAsync("select * from user where age > @age", new { age = 25 }) + + + + + + + + 查询 + + + + + + + 查询,ExecuteDataSetAsync("select * from user where age > @age; select 2", new { age = 25 }) + + + + + + + + 查询 + + + + + + + 查询,ExecuteDataTableAsync("select * from user where age > @age", new { age = 25 }) + + + + + + + + 在【主库】执行 + + + + + + + + 在【主库】执行,ExecuteNonQueryAsync("delete from user where age > @age", new { age = 25 }) + + + + + + + + 在【主库】执行 + + + + + + + + 在【主库】执行,ExecuteScalarAsync("select 1 from user where age > @age", new { age = 25 }) + + + + + + + + 执行SQL返回对象集合,QueryAsync<User>("select * from user where age > @age", new SqlParameter { ParameterName = "age", Value = 25 }) + + + + + + + + + + 执行SQL返回对象集合,QueryAsync<User>("select * from user where age > @age", new { age = 25 }) + + + + + + + + + 执行SQL返回对象集合,Query<User>("select * from user where age > @age; select * from address", new SqlParameter { ParameterName = "age", Value = 25 }) + + + + + + + + + + 执行SQL返回对象集合,Query<User>("select * from user where age > @age; select * from address", new { age = 25 }) + + + + + + + + + 监控 ToList 返回的的数据,用于拦截重新装饰 + + + + + 监视 Where,包括 select/update/delete,可控制使上层不被执行。 + + + + + 可自定义解析表达式 + + + + + 自定义实体的配置,方便和多个 ORM 共同使用 + + + + + 自定义实体的属性配置,方便和多个 ORM 共同使用 + + + + + 可重新装饰的引用数据 + + + + + 可使上层不被执行这个条件 + + + + + 内置解析功能,可辅助您进行解析 + + + + + 需要您解析的表达式 + + + + + 解析后的内容 + + + + + 实体类型 + + + + + 实体配置 + + + + + 实体类型 + + + + + 实体的属性 + + + + + 实体的属性配置 + + + + + 缓存数据时序列化方法,若无设置则默认使用 Json.net + + + + + 获取缓存数据时反序列化方法,若无设置则默认使用 Json.net + + + + + 缓存可序列化数据 + + + 缓存键 + 可序列化数据 + 缓存秒数,<=0时永久缓存 + + + + 循环或批量获取缓存数据 + + + + + + + + 循环或批量获取缓存数据 + + + + + + + 循环或批量删除缓存键 + + 缓存键[数组] + + + + 缓存壳 + + 缓存类型 + 缓存键 + 缓存秒数 + 获取源数据的函数 + + + + + 缓存壳(哈希表) + + 缓存类型 + 缓存键 + 字段 + 缓存秒数 + 获取源数据的函数 + + + + + 缓存可序列化数据 + + + 缓存键 + 可序列化数据 + 缓存秒数,<=0时永久缓存 + + + + 循环或批量获取缓存数据 + + + + + + + + 循环或批量获取缓存数据 + + + + + + + 循环或批量删除缓存键 + + 缓存键[数组] + + + + 缓存壳 + + 缓存类型 + 缓存键 + 缓存秒数 + 获取源数据的函数 + + + + + 缓存壳(哈希表) + + 缓存类型 + 缓存键 + 字段 + 缓存秒数 + 获取源数据的函数 + + + + + 【开发环境必备】自动同步实体结构到数据库,程序运行中检查实体表是否存在,然后创建或修改 + + + + + 转小写同步结构 + + + + + 转大写同步结构 + + + + + 使用数据库的主键和自增,适用 DbFirst 模式,无须在实体类型上设置 [Column(IsPrimary)] 或者 ConfigEntity。此功能目前可用于 mysql/sqlserver/postgresql。 + + + + + 不使用命令参数化执行,针对 Insert/Update + + + + + 延时加载导航属性对象,导航属性需要声明 virtual + + + + + 将实体类型与数据库对比,返回DDL语句 + + + + + + + 将实体类型集合与数据库对比,返回DDL语句 + + + + + + + 同步实体类型到数据库 + + + + + + + 同步实体类型集合到数据库 + + + + + + + 根据 System.Type 获取数据库信息 + + + + + + + 在外部配置实体的特性 + + + + + + + + 在外部配置实体的特性 + + + + + + + + 获取在外部配置实体的特性 + + + 未使用ConfigEntity配置时,返回null + + + + 获取实体类核心配置 + + + + + + + 获取所有数据库 + + + + + + 获取指定数据库的表信息,包括表、列详情、主键、唯一键、索引、外键、备注 + + + + + + + 获取数据库枚举类型int值 + + + + + + + 获取c#转换,(int)、(long) + + + + + + + 获取c#值 + + + + + + + 获取c#类型,int、long + + + + + + + 获取c#类型对象 + + + + + + + 获取ado.net读取方法, GetBoolean、GetInt64 + + + + + + + 序列化 + + + + + + + 反序列化 + + + + + + + 获取数据库枚举类型,适用 PostgreSQL + + + + + + + 中间表,多对多 + + + + + 测量两个经纬度的距离,返回单位:米 + + 经纬坐标1 + 经纬坐标2 + 返回距离(单位:米) + + + + 将 IEnumable<T> 转成 ISelect<T>,以便使用 FreeSql 的查询功能。此方法用于 Lambad 表达式中,快速进行集合导航的查询。 + + + + + + + + 生成类似Mongodb的ObjectId有序、不重复Guid + + + + + + 插入数据 + + + + + + + 插入数据,传入实体 + + + + + + + + 插入数据,传入实体数组 + + + + + + + + 插入数据,传入实体集合 + + + + + + + + 修改数据 + + + + + + + 修改数据,传入动态对象如:主键值 | new[]{主键值1,主键值2} | TEntity1 | new[]{TEntity1,TEntity2} | new{id=1} + + + 主键值、主键值集合、实体、实体集合、匿名对象、匿名对象集合 + + + + + 查询数据 + + + + + + + 查询数据,传入动态对象如:主键值 | new[]{主键值1,主键值2} | TEntity1 | new[]{TEntity1,TEntity2} | new{id=1} + + + 主键值、主键值集合、实体、实体集合、匿名对象、匿名对象集合 + + + + + 删除数据 + + + + + + + 删除数据,传入动态对象如:主键值 | new[]{主键值1,主键值2} | TEntity1 | new[]{TEntity1,TEntity2} | new{id=1} + + + 主键值、主键值集合、实体、实体集合、匿名对象、匿名对象集合 + + + + + 开启事务(不支持异步),60秒未执行完将自动提交 + + 事务体 () => {} + + + + 开启事务(不支持异步) + + 事务体 () => {} + 超时,未执行完将自动提交 + + + + 缓存 + + + + + 数据库访问对象 + + + + + 所有拦截方法都在这里 + + + + + CodeFirst 模式开发相关方法 + + + + + DbFirst 模式开发相关方法 + + + + + 测量两个经纬度的距离,返回单位:米 + + 经纬坐标1 + 经纬坐标2 + 返回距离(单位:米) + + + + 特殊处理类似 string.Format 的使用方法,防止注入,以及 IS NULL 转换 + + + + + + + + 特殊处理类似 string.Format 的使用方法,防止注入,以及 IS NULL 转换 + + + + + + + + 测量两个经纬度的距离,返回单位:米 + + 经纬坐标1 + 经纬坐标2 + 返回距离(单位:米) + + + + 测量两个经纬度的距离,返回单位:米 + + 经纬坐标1 + 经纬坐标2 + 返回距离(单位:米) + + + + 将 1010101010 这样的二进制字符串转换成 BitArray + + 1010101010 + + + + + 特殊处理类似 string.Format 的使用方法,防止注入,以及 IS NULL 转换 + + + + + + + + 特殊处理类似 string.Format 的使用方法,防止注入,以及 IS NULL 转换 + + + + + + + + 特殊处理类似 string.Format 的使用方法,防止注入,以及 IS NULL 转换 + + + + + + + diff --git a/FreeSql/Interface/Curd/IDelete.cs b/FreeSql/Interface/Curd/IDelete.cs index 9b4d7cce..5218d0ce 100644 --- a/FreeSql/Interface/Curd/IDelete.cs +++ b/FreeSql/Interface/Curd/IDelete.cs @@ -16,7 +16,7 @@ namespace FreeSql { /// /// 指定事务对象 /// - /// + /// /// IDelete WithConnection(DbConnection connection); @@ -63,7 +63,7 @@ namespace FreeSql { /// /// 设置表名规则,可用于分库/分表,参数1:默认表名;返回值:新表名; /// - /// + /// /// IDelete AsTable(Func tableRule); /// diff --git a/FreeSql/Interface/Curd/IInsert.cs b/FreeSql/Interface/Curd/IInsert.cs index 93b2a3ab..90c0239d 100644 --- a/FreeSql/Interface/Curd/IInsert.cs +++ b/FreeSql/Interface/Curd/IInsert.cs @@ -16,7 +16,7 @@ namespace FreeSql { /// /// 指定事务对象 /// - /// + /// /// IInsert WithConnection(DbConnection connection); @@ -61,7 +61,7 @@ namespace FreeSql { /// /// 设置表名规则,可用于分库/分表,参数1:默认表名;返回值:新表名; /// - /// + /// /// IInsert AsTable(Func tableRule); /// diff --git a/FreeSql/Interface/Curd/ISelect/ISelect0.cs b/FreeSql/Interface/Curd/ISelect/ISelect0.cs index 3d5e4a38..9a174962 100644 --- a/FreeSql/Interface/Curd/ISelect/ISelect0.cs +++ b/FreeSql/Interface/Curd/ISelect/ISelect0.cs @@ -25,7 +25,7 @@ namespace FreeSql { /// /// 审核或跟踪 ToList 即将返回的数据 /// - /// + /// /// TSelect TrackToList(Action action); @@ -68,7 +68,7 @@ namespace FreeSql { /// /// 设置表名规则,可用于分库/分表,参数1:实体类型;参数2:默认表名;返回值:新表名; /// - /// + /// /// TSelect AsTable(Func tableRule); /// diff --git a/FreeSql/Interface/Curd/ISelect/ISelect1.cs b/FreeSql/Interface/Curd/ISelect/ISelect1.cs index 5ad7b3b8..68e836d8 100644 --- a/FreeSql/Interface/Curd/ISelect/ISelect1.cs +++ b/FreeSql/Interface/Curd/ISelect/ISelect1.cs @@ -269,7 +269,7 @@ namespace FreeSql { /// /// 按选择的列分组,GroupBy(a => a.Name) | GroupBy(a => new{a.Name,a.Time}) /// - /// + /// /// ISelectGrouping GroupBy(Expression> exp); diff --git a/FreeSql/Interface/Curd/IUpdate.cs b/FreeSql/Interface/Curd/IUpdate.cs index e0f160ef..b16c0e65 100644 --- a/FreeSql/Interface/Curd/IUpdate.cs +++ b/FreeSql/Interface/Curd/IUpdate.cs @@ -16,7 +16,7 @@ namespace FreeSql { /// /// 指定事务对象 /// - /// + /// /// IUpdate WithConnection(DbConnection connection); @@ -76,7 +76,7 @@ namespace FreeSql { /// 设置列的的新值为基础上增加,格式:Set(a => a.Clicks + 1) 相当于 clicks=clicks+1 /// /// - /// + /// /// IUpdate Set(Expression> binaryExpression); /// @@ -130,7 +130,7 @@ namespace FreeSql { /// /// 设置表名规则,可用于分库/分表,参数1:默认表名;返回值:新表名; /// - /// + /// /// IUpdate AsTable(Func tableRule); /// diff --git a/FreeSql/Interface/IAdo.cs b/FreeSql/Interface/IAdo.cs index 744245d7..5f2263b1 100644 --- a/FreeSql/Interface/IAdo.cs +++ b/FreeSql/Interface/IAdo.cs @@ -162,7 +162,7 @@ namespace FreeSql { /// /// 执行SQL返回对象集合,Query<User>("select * from user where age > @age", new SqlParameter { ParameterName = "age", Value = 25 }) /// - /// + /// /// /// /// @@ -173,7 +173,7 @@ namespace FreeSql { /// /// 执行SQL返回对象集合,Query<User>("select * from user where age > @age", new { age = 25 }) /// - /// + /// /// /// /// diff --git a/FreeSql/Interface/ICache.cs b/FreeSql/Interface/ICache.cs index 5ef5a4bf..49bbbf0c 100644 --- a/FreeSql/Interface/ICache.cs +++ b/FreeSql/Interface/ICache.cs @@ -31,7 +31,6 @@ namespace FreeSql { /// /// 循环或批量获取缓存数据 /// - /// /// /// string Get(string key); @@ -47,8 +46,6 @@ namespace FreeSql { /// 缓存键 /// 缓存秒数 /// 获取源数据的函数 - /// 序列化函数 - /// 反序列化函数 /// T Shell(string key, int timeoutSeconds, Func getData); /// @@ -59,8 +56,6 @@ namespace FreeSql { /// 字段 /// 缓存秒数 /// 获取源数据的函数 - /// 序列化函数 - /// 反序列化函数 /// T Shell(string key, string field, int timeoutSeconds, Func getData); @@ -82,7 +77,6 @@ namespace FreeSql { /// /// 循环或批量获取缓存数据 /// - /// /// /// Task GetAsync(string key); @@ -97,9 +91,7 @@ namespace FreeSql { /// 缓存类型 /// 缓存键 /// 缓存秒数 - /// 获取源数据的函数 - /// 序列化函数 - /// 反序列化函数 + /// 获取源数据的函数 /// Task ShellAsync(string key, int timeoutSeconds, Func> getDataAsync); /// @@ -109,9 +101,7 @@ namespace FreeSql { /// 缓存键 /// 字段 /// 缓存秒数 - /// 获取源数据的函数 - /// 序列化函数 - /// 反序列化函数 + /// 获取源数据的函数 /// Task ShellAsync(string key, string field, int timeoutSeconds, Func> getDataAsync); } diff --git a/FreeSql/PostgreSQL/PostgreSQLAdo/PostgreSQLTypesExtensions.cs b/FreeSql/PostgreSQL/PostgreSQLAdo/PostgreSQLTypesExtensions.cs index 72f942fe..1eda91d1 100644 --- a/FreeSql/PostgreSQL/PostgreSQLAdo/PostgreSQLTypesExtensions.cs +++ b/FreeSql/PostgreSQL/PostgreSQLAdo/PostgreSQLTypesExtensions.cs @@ -41,7 +41,7 @@ public static partial class PostgreSQLTypesExtensions { /// /// 将 1010101010 这样的二进制字符串转换成 BitArray /// - /// 1010101010 + /// 1010101010 /// public static BitArray ToBitArray(this string _1010Str) { if (_1010Str == null) return null;