Update db.First by sqlite

This commit is contained in:
sunkaixuna 2022-01-09 16:24:43 +08:00
parent 149183fed8
commit 46cfed7e17
5 changed files with 36 additions and 2 deletions

View File

@ -214,7 +214,7 @@ namespace SqlSugar
internal string GetClassString(DbTableInfo tableInfo, ref string className)
{
string classText;
var columns = this.Context.DbMaintenance.GetColumnInfosByTableName(tableInfo.Name);
var columns = this.Context.DbMaintenance.GetColumnInfosByTableName(tableInfo.Name,false);
if (this.Context.IgnoreColumns.HasValue())
{
var entityName = this.Context.EntityMaintenance.GetEntityName(tableInfo.Name);

View File

@ -317,7 +317,7 @@ namespace SqlSugar
{
DbColumnInfo column = new DbColumnInfo()
{
TableName = tableName,
TableName =this.SqlBuilder.GetNoTranslationColumnName(tableName+""),
DataType = row["DataTypeName"].ToString().Trim(),
IsNullable = (bool)row["AllowDBNull"],
IsIdentity = (bool)row["IsAutoIncrement"],

View File

@ -84,6 +84,7 @@
<Compile Include="UnitTest\UAdo.cs" />
<Compile Include="UnitTest\UCodeFirst.cs" />
<Compile Include="UnitTest\UCustom01.cs" />
<Compile Include="UnitTest\UCustom02.cs" />
<Compile Include="UnitTest\UInsert.cs" />
<Compile Include="UnitTest\UJson.cs" />
<Compile Include="UnitTest\Updateable.cs" />

View File

@ -32,6 +32,7 @@ namespace OrmTest
public static void Init()
{
UCustom01.Init();
UCustom02.Init();
Insert();
CodeFirst();
Updateable();

View File

@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using F9.DataEntity.Entity;
using SqlSugar;
namespace OrmTest
{
public class UCustom02
{
public static void Init()
{
var db = NewUnitTest.Db;
foreach (DbTableInfo table in db.DbMaintenance.GetTableInfoList())
{
string entityName = table.Name.ToUpper();
db.MappingTables.Add(entityName, table.Name);
foreach (DbColumnInfo col in db.DbMaintenance.GetColumnInfosByTableName(table.Name))
{
string propertyName = col.DbColumnName.ToUpper();
//Console.WriteLine("propertyName=" + propertyName + ", column=" + col.DbColumnName);
db.MappingColumns.Add(propertyName, col.DbColumnName, entityName);
}
}
// Console.WriteLine(db.Utilities.SerializeObject(db.MappingColumns));
Check.Exception(!db.Queryable<Order>().ToClassString(null).Contains("Name"), "unit error");
}
}
}