mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-21 02:58:05 +08:00
Insert BUG
This commit is contained in:
@@ -116,6 +116,8 @@ new List<SugarParameter>() {
|
|||||||
|
|
||||||
insertObj.Name = null;
|
insertObj.Name = null;
|
||||||
var t10 = db.Insertable(insertObj).ExecuteCommand();
|
var t10 = db.Insertable(insertObj).ExecuteCommand();
|
||||||
|
|
||||||
|
var t11 = db.Insertable(new MyStudent() { Id = 1, Name = "张三" }).AS("Student").ToSql();
|
||||||
}
|
}
|
||||||
|
|
||||||
public SqlSugarClient GetInstance()
|
public SqlSugarClient GetInstance()
|
||||||
@@ -124,4 +126,10 @@ new List<SugarParameter>() {
|
|||||||
return db;
|
return db;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class MyStudent {
|
||||||
|
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -59,6 +59,16 @@ namespace SqlSugar
|
|||||||
return mappingInfo == null ? typeName : mappingInfo.DbTableName;
|
return mappingInfo == null ? typeName : mappingInfo.DbTableName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public string GetTableName(string entityName)
|
||||||
|
{
|
||||||
|
var typeName = entityName;
|
||||||
|
if (this.Context.MappingTables == null || this.Context.MappingTables.Count == 0) return typeName;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var mappingInfo = this.Context.MappingTables.SingleOrDefault(it => it.EntityName == typeName);
|
||||||
|
return mappingInfo == null ? typeName : mappingInfo.DbTableName;
|
||||||
|
}
|
||||||
|
}
|
||||||
public string GetEntityName(string tableName)
|
public string GetEntityName(string tableName)
|
||||||
{
|
{
|
||||||
if (this.Context.MappingTables == null || this.Context.MappingTables.Count == 0) return tableName;
|
if (this.Context.MappingTables == null || this.Context.MappingTables.Count == 0) return tableName;
|
||||||
|
@@ -201,7 +201,7 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
if (this.Context.IsSystemTablesConfig)
|
if (this.Context.IsSystemTablesConfig)
|
||||||
{
|
{
|
||||||
return this.Context.DbMaintenance.GetPrimaries(this.EntityInfo.DbTableName);
|
return this.Context.DbMaintenance.GetPrimaries(this.Context.EntityProvider.GetTableName(this.EntityInfo.EntityName));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -212,7 +212,7 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
if (this.Context.IsSystemTablesConfig)
|
if (this.Context.IsSystemTablesConfig)
|
||||||
{
|
{
|
||||||
return this.Context.DbMaintenance.GetIsIdentities(this.EntityInfo.DbTableName);
|
return this.Context.DbMaintenance.GetIsIdentities(this.Context.EntityProvider.GetTableName(this.EntityInfo.EntityName));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user