Update demo

This commit is contained in:
sunkaixuan
2023-11-06 10:31:08 +08:00
parent 777a7c6ddc
commit ebea347c58
4 changed files with 169 additions and 0 deletions

View File

@@ -1,6 +1,7 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Data.Linq;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -28,6 +29,10 @@ namespace OrmTest
// 根据 UserInfo001 实体类初始化表
db.CodeFirst.InitTables<UserInfo001>();
//Table structure and class are different
//表结构和类存在差异 初始化表
db.CodeFirst.InitTables<UserInfo002>();
//Insert
//插入
var id=db.Insertable(new UserInfo001()
@@ -101,5 +106,30 @@ namespace OrmTest
[SugarColumn(IsNullable = true)]
public DateTime? RegistrationDate { get; set; }
}
/// <summary>
/// User information entity class
/// 用户信息实体类
/// </summary>
[SugarTable("UserInfoA")]
public class UserInfo002
{
/// <summary>
/// User ID (Primary Key)
/// 用户ID主键
/// </summary>
[SugarColumn(IsIdentity = true,ColumnName ="Id", IsPrimaryKey = true)]
public int UserId { get; set; }
/// <summary>
/// User name
/// 用户名
/// </summary>
[SugarColumn(Length = 50,ColumnName ="Name", IsNullable = false)]
public string UserName { get; set; }
}
}
}