- 修复 LazyLoading 在 Net4 环境下的问题;

This commit is contained in:
28810
2019-12-19 10:51:21 +08:00
parent 954a948837
commit e03aaed55b
8 changed files with 47 additions and 20 deletions

View File

@ -0,0 +1 @@


View File

@ -31,7 +31,7 @@ public class User1 : BaseEntity<User1, Guid>
public int GroupId { get; set; }
public UserGroup Group { get; set; }
public List<Role> Roles { get; set; }
public virtual List<Role> Roles { get; set; }
/// <summary>
/// 登陆名

View File

@ -44,10 +44,13 @@ namespace base_entity
.UseConnectionString(FreeSql.DataType.Sqlite, "data source=test.db;max pool size=5")
//.UseConnectionString(FreeSql.DataType.MySql, "Data Source=127.0.0.1;Port=3306;User ID=root;Password=root;Initial Catalog=cccddd;Charset=utf8;SslMode=none;Max pool size=2")
.UseConnectionString(FreeSql.DataType.SqlServer, "Data Source=.;Integrated Security=True;Initial Catalog=freesqlTest;Pooling=true;Max Pool Size=3")
.UseLazyLoading(true)
.Build();
BaseEntity.Initialization(fsql);
#endregion
var us = User1.Select.Limit(10).ToList();
new Products { title = "product-1" }.Save();
new Products { title = "product-2" }.Save();
new Products { title = "product-3" }.Save();

View File

@ -17,6 +17,7 @@
<ItemGroup>
<ProjectReference Include="..\..\Extensions\FreeSql.Extensions.BaseEntity\FreeSql.Extensions.BaseEntity.csproj" />
<ProjectReference Include="..\..\Extensions\FreeSql.Extensions.JsonMap\FreeSql.Extensions.JsonMap.csproj" />
<ProjectReference Include="..\..\Extensions\FreeSql.Extensions.LazyLoading\FreeSql.Extensions.LazyLoading.csproj" />
<ProjectReference Include="..\..\FreeSql.Repository\FreeSql.Repository.csproj" />
<ProjectReference Include="..\..\FreeSql\FreeSql.csproj" />
<ProjectReference Include="..\..\Providers\FreeSql.Provider.MySql\FreeSql.Provider.MySql.csproj" />

View File

@ -35,13 +35,6 @@ namespace orm_vs
static void Main(string[] args)
{
var testlist1 = fsql.Select<Song>().OrderBy(a => a.Id).ToList();
var testlist2 = new List<Song>();
fsql.Select<Song>().OrderBy(a => a.Id).ToChunk(0, list =>
{
testlist2.AddRange(list);
});
fsql.CodeFirst.SyncStructure(typeof(Song), typeof(Song_tag), typeof(Tag));
//sugar.CodeFirst.InitTables(typeof(Song), typeof(Song_tag), typeof(Tag));
//sugar创建表失败SqlSugar.SqlSugarException: Sequence contains no elements