mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-23 22:11:36 +08:00
Update demo
This commit is contained in:
parent
d5b7306d37
commit
2c1d33b83b
@ -1,6 +1,7 @@
|
||||
using DorisTest;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace OrmTest
|
||||
{
|
||||
@ -10,22 +11,37 @@ namespace OrmTest
|
||||
static void Main(string[] args)
|
||||
{
|
||||
var db = DbHelper.GetNewDb();
|
||||
db.CodeFirst.InitTables<LogEntity>();
|
||||
db.CodeFirst.InitTables<Student11>();
|
||||
|
||||
db.Insertable(new Student11() { Id = 1, Age = 1, Name = "a" })
|
||||
db.CodeFirst.InitTables<LogEntity>();
|
||||
|
||||
db.DbMaintenance.TruncateTable<Student112>();//truncate data
|
||||
db.CodeFirst.InitTables<Student112>();//drop colum
|
||||
db.CodeFirst.InitTables<Student11>();//add column
|
||||
|
||||
db.Insertable(new Student11() { Id = 1, Age = 1, Name = "a",DateTime=DateTime.Now })
|
||||
.ExecuteCommand();
|
||||
var list=db.Queryable<Student11>().ToList();
|
||||
//var rows = db.Updateable(list.First()).ExecuteCommand();
|
||||
db.Deleteable(list).ExecuteCommand();
|
||||
}
|
||||
}
|
||||
}
|
||||
[SugarTable("Student1101")]
|
||||
public class Student112
|
||||
{
|
||||
[SqlSugar.SugarColumn(IsPrimaryKey = true)]
|
||||
public int Id { get; set; } // 学生ID (Student ID)
|
||||
public string Name { get; set; } // 学生姓名 (Student Name)
|
||||
public int Age { get; set; } // 学生年龄 (Student Ag
|
||||
}
|
||||
[SugarTable("Student1101")]
|
||||
public class Student11
|
||||
{
|
||||
[SqlSugar.SugarColumn(IsPrimaryKey = true )]
|
||||
public int Id { get; set; } // 学生ID (Student ID)
|
||||
public string Name { get; set; } // 学生姓名 (Student Name)
|
||||
public int Age { get; set; } // 学生年龄 (Student Age)
|
||||
[SugarColumn(IsNullable =true)]
|
||||
public DateTime DateTime { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -38,7 +54,7 @@ namespace OrmTest
|
||||
/// Database connection string
|
||||
/// 数据库连接字符串
|
||||
/// </summary>
|
||||
public readonly static string Connection = "server=39.170.74.19;port=9030 ;Database=test; Uid=root;Pwd=lq!1q!;Pooling=false;";
|
||||
public readonly static string Connection = "server=39.170.74.1;port=9031;Database=test;Uid=root;Pwd=lq!1211q!;Pooling=false;";
|
||||
|
||||
/// <summary>
|
||||
/// Get a new SqlSugarClient instance with specific configurations
|
||||
|
Loading…
Reference in New Issue
Block a user