Oracle CodeFirst BUG

This commit is contained in:
sunkaixuan 2018-11-29 11:40:34 +08:00
parent 62f34cd145
commit 58928e07be
2 changed files with 35 additions and 23 deletions

View File

@ -25,12 +25,19 @@ namespace OrmTest.Demo
[SugarColumn(Length = 110)]
public string A2 { get; set; }
}
public class CodeTable2 {
public class CodeTable2
{
public int Id { get; set; }
public string Name { get; set; }
[SugarColumn(IsIgnore = true)]
public string TestId { get; set; }
}
public class GuidTable
{
public Guid Name { get; set; }
[SugarColumn(IsPrimaryKey = true)]
public Guid Id { get; set; }
}
public class CodeFirst : DemoBase
{
public static void Init()
@ -47,7 +54,8 @@ namespace OrmTest.Demo
//db.CodeFirst.BackupTable().InitTables(typeof(CodeTable),typeof(CodeTable2));
//No backup table
db.CodeFirst.InitTables(typeof(CodeTable),typeof(CodeTable2));
}
db.CodeFirst.InitTables(typeof(GuidTable), typeof(CodeTable), typeof(CodeTable2));
}
}
}

View File

@ -282,7 +282,7 @@ namespace SqlSugar
this.Context.Ado.IsEnableLogEvent = oldIsEnableLog;
List<DbColumnInfo> result = new List<DbColumnInfo>();
var schemaTable = reader.GetSchemaTable();
foreach (DataRow row in schemaTable.Rows)
foreach (System.Data.DataRow row in schemaTable.Rows)
{
DbColumnInfo column = new DbColumnInfo()
{
@ -364,6 +364,10 @@ namespace SqlSugar
{
item.Length = 50;
}
if (item.DataType == "varchar" && item.Length == 0)
{
item.Length = 50;
}
}
}
string sql = GetCreateTableSql(tableName, columns);