mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-24 07:22:57 +08:00
Update db.First by sqlite
This commit is contained in:
parent
149183fed8
commit
46cfed7e17
@ -214,7 +214,7 @@ namespace SqlSugar
|
|||||||
internal string GetClassString(DbTableInfo tableInfo, ref string className)
|
internal string GetClassString(DbTableInfo tableInfo, ref string className)
|
||||||
{
|
{
|
||||||
string classText;
|
string classText;
|
||||||
var columns = this.Context.DbMaintenance.GetColumnInfosByTableName(tableInfo.Name);
|
var columns = this.Context.DbMaintenance.GetColumnInfosByTableName(tableInfo.Name,false);
|
||||||
if (this.Context.IgnoreColumns.HasValue())
|
if (this.Context.IgnoreColumns.HasValue())
|
||||||
{
|
{
|
||||||
var entityName = this.Context.EntityMaintenance.GetEntityName(tableInfo.Name);
|
var entityName = this.Context.EntityMaintenance.GetEntityName(tableInfo.Name);
|
||||||
|
@ -317,7 +317,7 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
DbColumnInfo column = new DbColumnInfo()
|
DbColumnInfo column = new DbColumnInfo()
|
||||||
{
|
{
|
||||||
TableName = tableName,
|
TableName =this.SqlBuilder.GetNoTranslationColumnName(tableName+""),
|
||||||
DataType = row["DataTypeName"].ToString().Trim(),
|
DataType = row["DataTypeName"].ToString().Trim(),
|
||||||
IsNullable = (bool)row["AllowDBNull"],
|
IsNullable = (bool)row["AllowDBNull"],
|
||||||
IsIdentity = (bool)row["IsAutoIncrement"],
|
IsIdentity = (bool)row["IsAutoIncrement"],
|
||||||
|
@ -84,6 +84,7 @@
|
|||||||
<Compile Include="UnitTest\UAdo.cs" />
|
<Compile Include="UnitTest\UAdo.cs" />
|
||||||
<Compile Include="UnitTest\UCodeFirst.cs" />
|
<Compile Include="UnitTest\UCodeFirst.cs" />
|
||||||
<Compile Include="UnitTest\UCustom01.cs" />
|
<Compile Include="UnitTest\UCustom01.cs" />
|
||||||
|
<Compile Include="UnitTest\UCustom02.cs" />
|
||||||
<Compile Include="UnitTest\UInsert.cs" />
|
<Compile Include="UnitTest\UInsert.cs" />
|
||||||
<Compile Include="UnitTest\UJson.cs" />
|
<Compile Include="UnitTest\UJson.cs" />
|
||||||
<Compile Include="UnitTest\Updateable.cs" />
|
<Compile Include="UnitTest\Updateable.cs" />
|
||||||
|
@ -32,6 +32,7 @@ namespace OrmTest
|
|||||||
public static void Init()
|
public static void Init()
|
||||||
{
|
{
|
||||||
UCustom01.Init();
|
UCustom01.Init();
|
||||||
|
UCustom02.Init();
|
||||||
Insert();
|
Insert();
|
||||||
CodeFirst();
|
CodeFirst();
|
||||||
Updateable();
|
Updateable();
|
||||||
|
32
Src/Asp.Net/SqliteTest/UnitTest/UCustom02.cs
Normal file
32
Src/Asp.Net/SqliteTest/UnitTest/UCustom02.cs
Normal 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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user