mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-19 04:18:16 +08:00
- 增加 NavigateAttribute 配置导航关系;
- 修复 LinqToSql 方法,开启自动迁移时,迁移了无关类的 bug; - 修复 Oracle DbFirst date(7) 类型未处理的 bug;#57 - 修复 AsSelect().Any() 未给其他条件时,产生 null bug; - 增加 FreeSql.Extensions.LazyLoading 对 .net 4.5 的支持; - 优化 MySql CodeFirst 增加 DateTime 迁移后,默认值为 0000-00-00 导致读取失败的 bug; - 优化 LazyLoading 友好错误提示;
This commit is contained in:
@ -7,7 +7,6 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="FreeSql.DbContext" Version="0.6.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.1.8" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
|
||||
<PackageReference Include="xunit" Version="2.4.0" />
|
||||
@ -15,6 +14,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\FreeSql.DbContext\FreeSql.DbContext\FreeSql.DbContext.csproj" />
|
||||
<ProjectReference Include="..\Extensions\FreeSql.Extensions.LazyLoading\FreeSql.Extensions.LazyLoading.csproj" />
|
||||
<ProjectReference Include="..\FreeSql\FreeSql.csproj" />
|
||||
<ProjectReference Include="..\Providers\FreeSql.Provider.MySql\FreeSql.Provider.MySql.csproj" />
|
||||
|
@ -210,10 +210,72 @@ namespace FreeSql.Tests {
|
||||
[Column(Name = "release_time")]
|
||||
public int ReleaseTime { get; set; }
|
||||
|
||||
public DateTime testaddtime { get; set; }
|
||||
public DateTime? testaddtime2 { get; set; }
|
||||
}
|
||||
|
||||
public class NewsArticleDto : NewsArticle {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class TaskBuildInfo {
|
||||
[FreeSql.DataAnnotations.Column(IsPrimary = true)]
|
||||
public Guid Id { get; set; }
|
||||
public Guid TbId { get; set; }
|
||||
public Guid DataBaseConfigId { get; set; }
|
||||
public string Name { get; set; }
|
||||
public int Level { get; set; }
|
||||
|
||||
[Column(IsIgnore = true)]
|
||||
public virtual TaskBuild TaskBuild { get; set; }
|
||||
}
|
||||
public class Templates {
|
||||
[Column(IsPrimary = true)]
|
||||
public Guid Id { get; set; }
|
||||
public string Title { get; set; }
|
||||
public DateTime AddTime { get; set; } = DateTime.Now;
|
||||
public DateTime EditTime { get; set; }
|
||||
[Column(DbType = "text")]
|
||||
public string Code { get; set; }
|
||||
}
|
||||
public class TaskBuild {
|
||||
|
||||
[FreeSql.DataAnnotations.Column(IsPrimary = true)]
|
||||
public Guid Id { get; set; }
|
||||
public string TaskName { get; set; }
|
||||
public Guid TemplatesId { get; set; }
|
||||
public string GeneratePath { get; set; }
|
||||
public string FileName { get; set; }
|
||||
public string NamespaceName { get; set; }
|
||||
public bool OptionsEntity01 { get; set; } = false;
|
||||
public bool OptionsEntity02 { get; set; } = false;
|
||||
public bool OptionsEntity03 { get; set; } = false;
|
||||
public bool OptionsEntity04 { get; set; } = false;
|
||||
|
||||
[Navigate("TbId")]
|
||||
public virtual ICollection<TaskBuildInfo> Builds { get; set; }
|
||||
public Templates Templates { get; set; }
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Test1() {
|
||||
g.sqlite.SetDbContextOptions(opt => opt.EnableAddOrUpdateNavigateList = true);
|
||||
var trepo = g.sqlite.GetGuidRepository<TaskBuild>();
|
||||
trepo.Insert(new TaskBuild {
|
||||
TaskName = "tt11",
|
||||
Builds = new[] {
|
||||
new TaskBuildInfo {
|
||||
Level = 1,
|
||||
Name = "t111_11"
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var ttdkdkd = trepo.Select.Where(a => a.Builds.AsSelect().Any()).ToList();
|
||||
|
||||
var list1113233 = trepo.Select.ToList();
|
||||
|
||||
|
||||
var entity = new NewsArticle {
|
||||
ArticleId = 1,
|
||||
@ -223,11 +285,16 @@ namespace FreeSql.Tests {
|
||||
ArticleId = 1,
|
||||
ChannelId = 1,
|
||||
};
|
||||
|
||||
g.mysql.Insert(new[] { entity }).ExecuteAffrows();
|
||||
|
||||
var sqldddkdk = g.mysql.Update<NewsArticle>(where)
|
||||
.SetSource(entity)
|
||||
.UpdateColumns(x => new { x.Status, x.CategoryId, x.ArticleTitle })
|
||||
.ToSql();
|
||||
|
||||
var sqldddklist = g.mysql.Select<NewsArticle>().Select(a => new NewsArticleDto { }).ToList();
|
||||
|
||||
|
||||
var sql1111333 = g.mysql.Update<Model2>()
|
||||
.SetSource(new Model2 { id = 1, Title = "xxx", Parent_id = 0 })
|
||||
|
Reference in New Issue
Block a user