diff --git a/FreeSql.Tests/FreeSql.Tests/UnitTest1.cs b/FreeSql.Tests/FreeSql.Tests/UnitTest1.cs index 1ccd662d..750f4948 100644 --- a/FreeSql.Tests/FreeSql.Tests/UnitTest1.cs +++ b/FreeSql.Tests/FreeSql.Tests/UnitTest1.cs @@ -16,6 +16,7 @@ using Zeus.Domain.Enum; using System.ComponentModel.DataAnnotations; using System.Reflection; using System.Threading; +using Newtonsoft.Json; namespace FreeSql.Tests { @@ -42,6 +43,8 @@ namespace FreeSql.Tests public string OrderTitle { get; set; } public string CustomerName { get; set; } public DateTime TransactionDate { get; set; } + + [JsonIgnore] public virtual List OrderDetails { get; set; } } public class OrderDetail diff --git a/FreeSql/FreeSql.xml b/FreeSql/FreeSql.xml index 8c5c2836..5151df8a 100644 --- a/FreeSql/FreeSql.xml +++ b/FreeSql/FreeSql.xml @@ -2109,90 +2109,122 @@ 实体类型 - @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 }) + 标识符,可将 CurdBefore 与 CurdAfter 进行匹配 - - - - + - 执行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 }) + 实体类型的元数据 - - - - - - - ntArgs.Property"> + + + 执行的 SQL + + + + + 参数化命令 + + + + + 发生的错误 + + + + + 执行SQL命令,返回的结果 + + + + + 耗时(单位:Ticks) + + + + + 耗时(单位:毫秒) + + + + + 标识符,可将 SyncStructureBeforeEventArgs 与 SyncStructureAfterEventArgs 进行匹配 + + + + + 实体类型 + + + + + 执行的 SQL + + + + + 发生的错误 + + + + + 耗时(单位:Ticks) + + + + + 耗时(单位:毫秒) + + + + + 类型 + + + + + 属性列的元数据 + + + 反射的属性信息 @@ -2476,167 +2508,6 @@ - - - 测量两个经纬度的距离,返回单位:米 - - 经纬坐标1 - - - 获取所有数据库 - - - - - - 获取指定数据库的表信息,包括表、列详情、主键、唯一键、索引、外键、备注 - - - - - - - 获取数据库枚举类型int值 - - - - - - - 获取c#转换,(int)、(long) - - - - - - - 获取c#值 - - - - - - - 获取c#类型,int、long - - - - - - - 获取c#类型对象 - - - - - - - 获取ado.net读取方法, GetBoolean、GetInt64 - - - - - - - 序列化 - - - - - - - 反序列化 - - - - - - - 获取数据库枚举类型,适用 PostgreSQL - - - - - - - AsType, Ctor, ClearData 三处地方需要重新加载 - - - - - AsType, Ctor, ClearData 三处地方需要重新加载 - - - - - 通过属性的注释文本,通过 xml 读取 - - - Dict:key=属性名,value=注释 - - - - 创建一个过滤器 - - - 名字 - 表达式 - - - - - 中间表,多对多 - - - - - 不进行任何处理 - - - - - 将帕斯卡命名字符串转换为下划线分隔字符串 - - BigApple -> Big_Apple - - - - - 将帕斯卡命名字符串转换为下划线分隔字符串,且转换为全大写 - - BigApple -> BIG_APPLE - - - - - 将帕斯卡命名字符串转换为下划线分隔字符串,且转换为全小写 - - BigApple -> big_apple - - - - - 将字符串转换为大写 - - BigApple -> BIGAPPLE - - - - - 将字符串转换为小写 - - BigApple -> bigapple - - - - - 将帕斯卡命名字符串转换为下划线分隔字符串 - - BigApple -> Big_Apple - - - - 测量两个经纬度的距离,返回单位:米 @@ -2893,3 +2764,159 @@ + + + + 使用 or 拼接两个 lambda 表达式 + + + + + + 使用 or 拼接两个 lambda 表达式 + + + + true 时生效 + + + + + + 将 lambda 表达式取反 + + + + true 时生效 + + + + + 生成类似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 模式开发相关方法 + + + + + 全局过滤设置,可默认附加为 Select/Update/Delete 条件 + + + + diff --git a/FreeSql/Internal/UtilsExpressionTree.cs b/FreeSql/Internal/UtilsExpressionTree.cs index 84faec3d..c3aa32ac 100644 --- a/FreeSql/Internal/UtilsExpressionTree.cs +++ b/FreeSql/Internal/UtilsExpressionTree.cs @@ -366,10 +366,9 @@ namespace FreeSql.Internal .AppendLine("using FreeSql.DataAnnotations;") .AppendLine("using System.Collections.Generic;") .AppendLine("using System.Linq;") - .AppendLine("using Newtonsoft.Json;") .AppendLine() .Append("public class ").Append(trytbTypeLazyName).Append(" : ").Append(trytbTypeName).AppendLine(" {") - .AppendLine(" [JsonIgnore] private IFreeSql __fsql_orm__ { get; set; }\r\n"); + .AppendLine(" private IFreeSql __fsql_orm__ { get; set; }\r\n"); } var cscodeLength = cscode?.Length ?? 0;