mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-12-27 06:35:49 +08:00
Update demo
This commit is contained in:
@@ -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; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user