mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-12-21 19:09:57 +08:00
Add unit test
This commit is contained in:
18
Src/Asp.Net/SqliteTest/UnitTest/Models/Book.cs
Normal file
18
Src/Asp.Net/SqliteTest/UnitTest/Models/Book.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using SqlSugar;
|
||||
using System.Security.Principal;
|
||||
|
||||
namespace Test.Model
|
||||
{
|
||||
[SugarTable("BookA01")]
|
||||
public class Book
|
||||
{
|
||||
[SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true)]
|
||||
public int? Id { get; set; }
|
||||
|
||||
[SugarColumn(ColumnName = "Name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[SugarColumn(ColumnName = "PId")]
|
||||
public int? PId { get; set; }
|
||||
}
|
||||
}
|
||||
18
Src/Asp.Net/SqliteTest/UnitTest/Models/Playground.cs
Normal file
18
Src/Asp.Net/SqliteTest/UnitTest/Models/Playground.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using SqlSugar;
|
||||
using System.Security.Principal;
|
||||
|
||||
namespace Test.Model
|
||||
{
|
||||
[SugarTable("PlaygroundA01")]
|
||||
public class Playground
|
||||
{
|
||||
[SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true)]
|
||||
public int? Id { get; set; }
|
||||
|
||||
[SugarColumn(ColumnName = "Name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[SugarColumn(ColumnName = "PId")]
|
||||
public int? PId { get; set; }
|
||||
}
|
||||
}
|
||||
18
Src/Asp.Net/SqliteTest/UnitTest/Models/Room.cs
Normal file
18
Src/Asp.Net/SqliteTest/UnitTest/Models/Room.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using SqlSugar;
|
||||
using System.Security.Principal;
|
||||
|
||||
namespace Test.Model
|
||||
{
|
||||
[SugarTable("RoomA01")]
|
||||
public class Room
|
||||
{
|
||||
[SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true)]
|
||||
public int? Id { get; set; }
|
||||
|
||||
[SugarColumn(ColumnName = "Name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[SugarColumn(ColumnName = "PId")]
|
||||
public int? PId { get; set; }
|
||||
}
|
||||
}
|
||||
25
Src/Asp.Net/SqliteTest/UnitTest/Models/School.cs
Normal file
25
Src/Asp.Net/SqliteTest/UnitTest/Models/School.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using SqlSugar;
|
||||
using System.Collections.Generic;
|
||||
using System.Security.Principal;
|
||||
|
||||
namespace Test.Model
|
||||
{
|
||||
[SugarTable("SchoolA01")]
|
||||
public class School
|
||||
{
|
||||
[SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true)]
|
||||
public int? Id { get; set; }
|
||||
|
||||
[SugarColumn(ColumnName = "Name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[SugarColumn(ColumnName = "PId")]
|
||||
public int? PId { get; set; }
|
||||
|
||||
[Navigate(NavigateType.OneToMany, nameof(Room.PId))]
|
||||
public List<Room> Rooms { get; set; }
|
||||
|
||||
[Navigate(NavigateType.OneToMany, nameof(Playground.PId))]
|
||||
public List<Playground> Playgrounds { get; set; }
|
||||
}
|
||||
}
|
||||
24
Src/Asp.Net/SqliteTest/UnitTest/Models/Student.cs
Normal file
24
Src/Asp.Net/SqliteTest/UnitTest/Models/Student.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using SqlSugar;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Test.Model
|
||||
{
|
||||
[SugarTable("StudentA01")]
|
||||
public class Student
|
||||
{
|
||||
[SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true)]
|
||||
public int? Id { get; set; }
|
||||
|
||||
[SugarColumn(ColumnName = "Name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[SugarColumn(ColumnName = "Age")]
|
||||
public string Age { get; set; }
|
||||
|
||||
[Navigate(NavigateType.OneToMany, nameof(Book.PId))]
|
||||
public List<Book> Books { get; set; }
|
||||
|
||||
[Navigate(NavigateType.OneToMany, nameof(School.PId))]
|
||||
public List<School> Schools { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user