mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-19 12:28:15 +08:00
完成延时加载开发与测试,ICollection集合待支持
This commit is contained in:
@ -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();
|
||||
|
Reference in New Issue
Block a user