完成延时加载开发与测试,ICollection集合待支持

This commit is contained in:
28810
2019-01-19 19:11:15 +08:00
parent 56d79c9696
commit a7896007a9
25 changed files with 144 additions and 42 deletions

View File

@ -10,28 +10,39 @@ namespace FreeSql.Tests.MySql {
ISelect<Topic> select => g.mysql.Select<Topic>();
[Table(Name = "tb_topic")]
class Topic {
public class Topic {
[Column(IsIdentity = true, IsPrimary = true)]
public int Id { get; set; }
public int Clicks { get; set; }
public int TestTypeInfoGuid { get; set; }
public TestTypeInfo Type { get; set; }
public int TypeGuid { get; set; }
public virtual TestTypeInfo Type { get; set; }
public string Title { get; set; }
public DateTime CreateTime { get; set; }
}
class TestTypeInfo {
public class TestTypeInfo {
[Column(IsIdentity = true)]
public int Guid { get; set; }
public int ParentId { get; set; }
public TestTypeParentInfo Parent { get; set; }
public string Name { get; set; }
}
class TestTypeParentInfo {
public class TestTypeParentInfo {
[Column(IsIdentity = true)]
public int Id { get; set; }
public string Name { get; set; }
public List<TestTypeInfo> Types { get; set; }
}
[Fact]
public void Lazy() {
Topic t = g.mysql.Select<Topic>(2).ToOne();
Topic tz = g.mysql.Select<Topic>(2).ToOne();
var tzType = tz.Type;
}
[Fact]
public void ToList() {
var t0 = select.Limit(50).ToList();

View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
@ -11,7 +12,7 @@ public class g {
.UseMonitorCommand(
cmd => {
Console.WriteLine(cmd.CommandText);
Trace.WriteLine(cmd.CommandText);
}, //监听SQL命令对象在执行前
(cmd, traceLog) => {
Console.WriteLine(traceLog);