mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 10:42:52 +08:00
- 修复 Guid -> MapType(string) 在 FreeSql.DbContext 的类型转换错误;
This commit is contained in:
parent
fc4e834452
commit
7311ae600c
@ -120,13 +120,6 @@
|
|||||||
清空状态数据
|
清空状态数据
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:FreeSql.DbSet`1.RemoveAsync(System.Linq.Expressions.Expression{System.Func{`0,System.Boolean}})">
|
|
||||||
<summary>
|
|
||||||
根据 lambda 条件删除数据
|
|
||||||
</summary>
|
|
||||||
<param name="predicate"></param>
|
|
||||||
<returns></returns>
|
|
||||||
</member>
|
|
||||||
<member name="M:FreeSql.DbSet`1.Add(`0)">
|
<member name="M:FreeSql.DbSet`1.Add(`0)">
|
||||||
<summary>
|
<summary>
|
||||||
添加
|
添加
|
||||||
@ -457,14 +450,5 @@
|
|||||||
<param name="that"></param>
|
<param name="that"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:Microsoft.Extensions.DependencyInjection.FreeSqlRepositoryDependencyInjection.AddFreeRepository(Microsoft.Extensions.DependencyInjection.IServiceCollection,System.Action{FreeSql.FluentDataFilter},System.Reflection.Assembly[])">
|
|
||||||
<summary>
|
|
||||||
批量注入 Repository,可以参考代码自行调整
|
|
||||||
</summary>
|
|
||||||
<param name="services"></param>
|
|
||||||
<param name="globalDataFilter"></param>
|
|
||||||
<param name="assemblies"></param>
|
|
||||||
<returns></returns>
|
|
||||||
</member>
|
|
||||||
</members>
|
</members>
|
||||||
</doc>
|
</doc>
|
||||||
|
@ -18,6 +18,7 @@ namespace FreeSql.Tests.SqlServerMapType
|
|||||||
|
|
||||||
class ToStringMap
|
class ToStringMap
|
||||||
{
|
{
|
||||||
|
[Column(MapType = typeof(string))]
|
||||||
public Guid id { get; set; }
|
public Guid id { get; set; }
|
||||||
|
|
||||||
[Column(MapType = typeof(string))]
|
[Column(MapType = typeof(string))]
|
||||||
@ -49,6 +50,19 @@ namespace FreeSql.Tests.SqlServerMapType
|
|||||||
[Fact]
|
[Fact]
|
||||||
public void Enum1()
|
public void Enum1()
|
||||||
{
|
{
|
||||||
|
g.sqlserver.Aop.AuditValue += new EventHandler<FreeSql.Aop.AuditValueEventArgs>((s, e) =>
|
||||||
|
{
|
||||||
|
if (e.Column.CsType == typeof(Guid) &&
|
||||||
|
e.Column.Attribute.MapType == typeof(string) &&
|
||||||
|
e.Value?.ToString() == Guid.Empty.ToString())
|
||||||
|
e.Value = FreeUtil.NewMongodbId();
|
||||||
|
});
|
||||||
|
|
||||||
|
g.sqlserver.GetRepository<ToStringMap>().InsertOrUpdate(new ToStringMap
|
||||||
|
{
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
//insert
|
//insert
|
||||||
var orm = g.sqlserver;
|
var orm = g.sqlserver;
|
||||||
var item = new ToStringMap { };
|
var item = new ToStringMap { };
|
||||||
|
@ -55,6 +55,7 @@ namespace FreeSql.Extensions.EntityUtil
|
|||||||
{
|
{
|
||||||
Expression newguid = Expression.Call(MethodFreeUtilNewMongodbId);
|
Expression newguid = Expression.Call(MethodFreeUtilNewMongodbId);
|
||||||
if (pks[a].Attribute.MapType != pks[a].CsType) newguid = FreeSql.Internal.Utils.GetDataReaderValueBlockExpression(pks[a].CsType, newguid);
|
if (pks[a].Attribute.MapType != pks[a].CsType) newguid = FreeSql.Internal.Utils.GetDataReaderValueBlockExpression(pks[a].CsType, newguid);
|
||||||
|
if (pks[a].CsType == typeof(Guid)) newguid = Expression.Convert(newguid, typeof(Guid));
|
||||||
if (pks[a].CsType == typeof(Guid?)) newguid = Expression.Convert(newguid, typeof(Guid?));
|
if (pks[a].CsType == typeof(Guid?)) newguid = Expression.Convert(newguid, typeof(Guid?));
|
||||||
expthen = Expression.Block(
|
expthen = Expression.Block(
|
||||||
new Expression[]{
|
new Expression[]{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user