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
37250f7512
commit
97375f5d1e
@ -44,6 +44,14 @@ namespace OrmTest
|
|||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Db.Ado.ExecuteCommand(@" create schema [user]");
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
}
|
||||||
db.CodeFirst.InitTables<UnitTableName>();
|
db.CodeFirst.InitTables<UnitTableName>();
|
||||||
db.CodeFirst.InitTables<UnitGe>();
|
db.CodeFirst.InitTables<UnitGe>();
|
||||||
db.Insertable(new UnitGe() { geometry1 = "POINT (20 180)" }).ExecuteCommand();
|
db.Insertable(new UnitGe() { geometry1 = "POINT (20 180)" }).ExecuteCommand();
|
||||||
@ -58,6 +66,7 @@ namespace OrmTest
|
|||||||
Db.Insertable(new UnitCodeFirst131() { Id = 1 }).ExecuteCommand();
|
Db.Insertable(new UnitCodeFirst131() { Id = 1 }).ExecuteCommand();
|
||||||
Db.CodeFirst.InitTables<UNITCODEFIRST131>();
|
Db.CodeFirst.InitTables<UNITCODEFIRST131>();
|
||||||
Db.CodeFirst.InitTables<UNITCOdEFIRST131>();
|
Db.CodeFirst.InitTables<UNITCOdEFIRST131>();
|
||||||
|
Db.CodeFirst.InitTables<UnitTableUserName>();
|
||||||
}
|
}
|
||||||
public class UnitCodeFirst131
|
public class UnitCodeFirst131
|
||||||
{
|
{
|
||||||
@ -107,6 +116,11 @@ namespace OrmTest
|
|||||||
public TimeSpan Id { get; set; }
|
public TimeSpan Id { get; set; }
|
||||||
public TimeSpan id2 { get; set; }
|
public TimeSpan id2 { get; set; }
|
||||||
}
|
}
|
||||||
|
[SugarTable("user.UnitTableUserName", "备注")]
|
||||||
|
public class UnitTableUserName
|
||||||
|
{
|
||||||
|
public string Id { get; set; }
|
||||||
|
}
|
||||||
public class UnitTest0122132
|
public class UnitTest0122132
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -359,9 +359,16 @@ namespace SqlSugar
|
|||||||
if (schemas.Any(y => y.EqualCase(tableSchemas)))
|
if (schemas.Any(y => y.EqualCase(tableSchemas)))
|
||||||
{
|
{
|
||||||
sql = string.Format(this.AddTableRemarkSql, this.SqlBuilder.GetNoTranslationColumnName(tableName.Split('.').Last()), description);
|
sql = string.Format(this.AddTableRemarkSql, this.SqlBuilder.GetNoTranslationColumnName(tableName.Split('.').Last()), description);
|
||||||
|
if (tableSchemas.EqualCase("user"))
|
||||||
|
{
|
||||||
|
sql = sql.Replace("N'user', N'dbo'", $"N'user', '{tableSchemas}'").Replace("N'user'", "N'SCHEMA'");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
sql = sql.Replace("N'dbo'", $"N'{tableSchemas}'").Replace("N'user'", "N'SCHEMA'");
|
sql = sql.Replace("N'dbo'", $"N'{tableSchemas}'").Replace("N'user'", "N'SCHEMA'");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
this.Context.Ado.ExecuteCommand(sql);
|
this.Context.Ado.ExecuteCommand(sql);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user