mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-23 22:11:36 +08:00
Update CodeFirst
This commit is contained in:
parent
5a049b308a
commit
da7d6eba34
@ -15,8 +15,19 @@ namespace OrmTest
|
|||||||
Db.DbMaintenance.DropTable("UnitCodeTest1");
|
Db.DbMaintenance.DropTable("UnitCodeTest1");
|
||||||
Db.CodeFirst.InitTables<UnitCodeTest1>();
|
Db.CodeFirst.InitTables<UnitCodeTest1>();
|
||||||
Db.CodeFirst.InitTables<UnitCodeFirstpks2>();
|
Db.CodeFirst.InitTables<UnitCodeFirstpks2>();
|
||||||
|
var db = Db;
|
||||||
|
db.Aop.OnLogExecuting = (s, p) =>
|
||||||
|
{
|
||||||
|
Console.WriteLine(s);
|
||||||
|
};
|
||||||
|
Db.CodeFirst.InitTables<UnitCodeFirstpks3>();
|
||||||
|
}
|
||||||
|
[SqlSugar.SugarTable("UnitCodeFirstpks3",IsDisabledDelete = true)]
|
||||||
|
public class UnitCodeFirstpks3
|
||||||
|
{
|
||||||
|
public int id { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class UnitCodeFirstpks2
|
public class UnitCodeFirstpks2
|
||||||
{
|
{
|
||||||
[SqlSugar.SugarColumn(IsPrimaryKey =true)]
|
[SqlSugar.SugarColumn(IsPrimaryKey =true)]
|
||||||
|
@ -184,7 +184,7 @@ namespace SqlSugar
|
|||||||
this.Context.DbMaintenance.AddColumn(tableName, EntityColumnToDbColumn(entityInfo, tableName, item));
|
this.Context.DbMaintenance.AddColumn(tableName, EntityColumnToDbColumn(entityInfo, tableName, item));
|
||||||
isChange = true;
|
isChange = true;
|
||||||
}
|
}
|
||||||
if (entityInfo.IsDisabledDelete)
|
if (entityInfo.IsDisabledDelete==false)
|
||||||
{
|
{
|
||||||
foreach (var item in dropColumns)
|
foreach (var item in dropColumns)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user