mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-19 04:18:16 +08:00
## v0.9.16
- 增加 BaseRepository.AttachOnlyPrimary 方法,只附加实体的主键值; > 在更新前使用可实现不查询数据库再更新、也可以实现更新时不更新值为 null 的字段 ```csharp class T { public int id { get; set; } public string name { get; set; } public string other { get; set; } } var item = new T { id = 1, name = "xx" }; fsql.GetRepository<T>().AttachOnlyPrimary(item).Update(item); //只更新 name ``` - 修复 Lambda 表达式中 DateTime.Now.ToString("yyyyMMdd") 不能直接执行的 bug;
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netstandard2.0;net45</TargetFrameworks>
|
||||
<Version>0.9.15</Version>
|
||||
<Version>0.9.16</Version>
|
||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||
<Authors>YeXiangQin</Authors>
|
||||
<Description>FreeSql 数据库实现,基于 Sqlite 3.0</Description>
|
||||
|
@ -83,7 +83,7 @@ namespace FreeSql.Sqlite
|
||||
if (callExp.Method.DeclaringType.IsNumberType()) return "random()";
|
||||
break;
|
||||
case "ToString":
|
||||
if (callExp.Object != null) return $"cast({getExp(callExp.Object)} as character)";
|
||||
if (callExp.Object != null) return callExp.Arguments.Count == 0 ? $"cast({getExp(callExp.Object)} as character)" : null;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -389,7 +389,7 @@ namespace FreeSql.Sqlite
|
||||
break;
|
||||
case "Equals": return $"({left} = {getExp(exp.Arguments[0])})";
|
||||
case "CompareTo": return $"(strftime('%s',{left})-strftime('%s',{args1}))";
|
||||
case "ToString": return $"strftime('%Y-%m-%d %H:%M.%f',{left})";
|
||||
case "ToString": return exp.Arguments.Count == 0 ? $"strftime('%Y-%m-%d %H:%M.%f',{left})" : null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
Reference in New Issue
Block a user