mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-23 13:06:50 +08:00
Update includes guid bug
This commit is contained in:
parent
109fb22849
commit
c243f32883
@ -27,7 +27,7 @@ namespace OrmTest
|
||||
DemoA_DbMain.Init();
|
||||
DemoB_Aop.Init();
|
||||
DemoC_GobalFilter.Init();
|
||||
DemoD_DbFirst.Init();;
|
||||
//DemoD_DbFirst.Init();;
|
||||
DemoE_CodeFirst.Init();
|
||||
DemoF_Utilities.Init();
|
||||
DemoG_SimpleClient.Init();
|
||||
@ -36,7 +36,7 @@ namespace OrmTest
|
||||
DemoL_Snowflake.Init();
|
||||
DemoM_UnitOfWork.Init();
|
||||
//Unit test
|
||||
NewUnitTest.Init();
|
||||
//NewUnitTest.Init();
|
||||
|
||||
//Rest Data
|
||||
NewUnitTest.RestData();
|
||||
|
@ -99,6 +99,7 @@
|
||||
<Compile Include="UnitTest\Models\TestModel.cs" />
|
||||
<Compile Include="UnitTest\Models\UserEntity.cs" />
|
||||
<Compile Include="UnitTest\Models\UserRoleEntity.cs" />
|
||||
<Compile Include="UnitTest\UCustom016.cs" />
|
||||
<Compile Include="UnitTest\UCustom015.cs" />
|
||||
<Compile Include="UnitTest\UCustom014.cs" />
|
||||
<Compile Include="UnitTest\UCustom013.cs" />
|
||||
|
@ -31,6 +31,7 @@ namespace OrmTest
|
||||
}
|
||||
public static void Init()
|
||||
{
|
||||
UCustom016.Init();
|
||||
UCustom015.Init();
|
||||
UCustom014.Init();
|
||||
UCustom013.Init();
|
||||
|
60
Src/Asp.Net/SqlServerTest/UnitTest/UCustom016.cs
Normal file
60
Src/Asp.Net/SqlServerTest/UnitTest/UCustom016.cs
Normal file
@ -0,0 +1,60 @@
|
||||
using OrmTest.UnitTest.Models;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OrmTest
|
||||
{
|
||||
public class UCustom016
|
||||
{
|
||||
|
||||
public static void Init()
|
||||
{
|
||||
var db = NewUnitTest.Db;
|
||||
|
||||
|
||||
|
||||
db.CodeFirst.InitTables<A1, B1, ABMapping1>();
|
||||
db.DbMaintenance.TruncateTable<A1>();
|
||||
db.DbMaintenance.TruncateTable<B1>();
|
||||
db.DbMaintenance.TruncateTable<ABMapping1>();
|
||||
db.Insertable(new A1() { Id = Guid.NewGuid(), Name = "a1" }).ExecuteCommand();
|
||||
|
||||
db.Insertable(new B1() { Id = Guid.NewGuid(), Name = "b1" }).ExecuteCommand();
|
||||
db.Insertable(new B1() { Id = Guid.NewGuid(), Name = "b2" }).ExecuteCommand();
|
||||
db.Insertable(new ABMapping1() { AId = Guid.NewGuid(), BId = Guid.NewGuid() }).ExecuteCommand();
|
||||
db.Queryable<A1>().Includes(X => X.BList).ToList();
|
||||
}
|
||||
[SugarTable("ABMapping1Guid")]
|
||||
public class ABMapping1
|
||||
{
|
||||
[SugarColumn(IsPrimaryKey = true )]
|
||||
public Guid AId { get; set; }
|
||||
[SugarColumn(IsPrimaryKey = true)]
|
||||
public Guid BId { get; set; }
|
||||
}
|
||||
[SugarTable("A1Guid")]
|
||||
public class A1
|
||||
{
|
||||
[SugarColumn(IsPrimaryKey = true )]
|
||||
public Guid Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
[Navigate(typeof(ABMapping1),nameof(ABMapping1.AId),nameof(ABMapping1.BId))]
|
||||
public List<B1> BList { get; set; }
|
||||
}
|
||||
[SugarTable("B1Guid")]
|
||||
public class B1
|
||||
{
|
||||
[SugarColumn(IsPrimaryKey = true )]
|
||||
public Guid Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
[Navigate(typeof(ABMapping1), nameof(ABMapping1.BId), nameof(ABMapping1.AId))]
|
||||
public List<A1> AList { get; set; }
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -201,6 +201,10 @@ namespace SqlSugar
|
||||
{
|
||||
inValue1 = inValue1.Replace("[null]", "null");
|
||||
}
|
||||
if (item.CSharpTypeName.EqualCase("guid")&& inValue1=="('')")
|
||||
{
|
||||
inValue1 = $"('{Guid.Empty.ToString()}')";
|
||||
}
|
||||
builder.AppendFormat(temp, type, item.FieldName.ToSqlFilter(), "IN", inValue1);
|
||||
parameters.Add(new SugarParameter(parameterName, item.FieldValue));
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user