SqlSugar/Src/Asp.NetCore2/SqliteTest/UserTestCases/Unitafadsa.cs

57 lines
1.4 KiB
C#
Raw Normal View History

2023-11-13 11:24:02 +08:00
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OrmTest
{
internal class Unitafadsa
{
public static void Init()
{
var db = NewUnitTest.Db;
db.CodeFirst.InitTables<School>();
db.CodeFirst.InitTables<School2>();
db.Queryable<School2>().ToList();
2024-02-05 15:22:29 +08:00
var list2 = db.Reportable(new List<Unitguidsda>() {
new Unitguidsda()
}).ToQueryable().ToList();
2023-11-13 11:24:02 +08:00
}
2024-02-05 15:22:29 +08:00
public class Unitguidsda
{
public Guid Id { get; set; } = Guid.NewGuid();
}
2023-11-13 11:24:02 +08:00
/// <summary>
/// 多主键表
/// </summary>
[SugarTable("dbschool")]
public class School
{
[SugarColumn(IsPrimaryKey = true)]
public string Id { get; set; }
[SugarColumn(IsPrimaryKey = true)]
public int SchoolId { get; set; }
}
/// <summary>
/// 多主键表
/// </summary>
[SugarTable("dbschool")]
public class School2
{
[SugarColumn(IsPrimaryKey = true)]
public string Id { get; set; }
[SugarColumn(IsPrimaryKey = true)]
public int SchoolId { get; set; }
public string Remark { get; set; }
}
}
}