mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-04-24 18:04:52 +08:00
Update exp to sql
This commit is contained in:
parent
c7b0d9e31e
commit
ce877b3411
@ -102,6 +102,7 @@
|
||||
<Compile Include="UnitTest\UCustom01.cs" />
|
||||
<Compile Include="UnitTest\UCustom02.cs" />
|
||||
<Compile Include="UnitTest\UCustom03.cs" />
|
||||
<Compile Include="UnitTest\UCustom06.cs" />
|
||||
<Compile Include="UnitTest\UCustom05.cs" />
|
||||
<Compile Include="UnitTest\UCustom04.cs" />
|
||||
<Compile Include="UnitTest\UDelete.cs" />
|
||||
|
@ -36,6 +36,7 @@ namespace OrmTest
|
||||
UCustom03.Init();
|
||||
UCustom04.Init();
|
||||
UCustom05.Init();
|
||||
UCustom06.Init();
|
||||
SubQueryTest();
|
||||
UConfig();
|
||||
DeleteTest();
|
||||
|
46
Src/Asp.Net/SqlServerTest/UnitTest/UCustom06.cs
Normal file
46
Src/Asp.Net/SqlServerTest/UnitTest/UCustom06.cs
Normal file
@ -0,0 +1,46 @@
|
||||
using OrmTest.UnitTest.Models;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OrmTest
|
||||
{
|
||||
public class UCustom06
|
||||
{
|
||||
public static void Init()
|
||||
{
|
||||
var db = NewUnitTest.Db;
|
||||
|
||||
db.CodeFirst.InitTables<Unit06>();
|
||||
db.Insertable(new Unit06() { Company = "1", Name = "2", Work = "3" }).ExecuteCommand();
|
||||
var list = db.Queryable<Unit06>().Select(a => new UnitPeople
|
||||
{
|
||||
Name = a.Name,
|
||||
Job = new UnitJobClass { Company = a.Company, Work = a.Work }
|
||||
}
|
||||
).ToList();
|
||||
|
||||
|
||||
}
|
||||
public class Unit06
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Company { get; set; }
|
||||
public string Work { get; set; }
|
||||
}
|
||||
public class UnitPeople
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public UnitJobClass Job { get; set; }
|
||||
}
|
||||
|
||||
public class UnitJobClass
|
||||
{
|
||||
public string Company { get; set; }
|
||||
public string Work { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
@ -621,7 +621,14 @@ namespace SqlSugar
|
||||
{
|
||||
dbColumnName = mappingInfo.DbColumnName;
|
||||
}
|
||||
asName = this.Context.GetTranslationText(shortName+"."+item.Type.Name + "." + propertyName);
|
||||
if (shortName != null && shortName.ObjToString().Contains(this.Context.SqlTranslationLeft))
|
||||
{
|
||||
asName = this.Context.GetTranslationText(item.Type.Name + "." + propertyName);
|
||||
}
|
||||
else
|
||||
{
|
||||
asName = this.Context.GetTranslationText(shortName + "." + item.Type.Name + "." + propertyName);
|
||||
}
|
||||
if (Context.IsJoin)
|
||||
{
|
||||
this.Context.Result.Append(Context.GetAsString(asName, dbColumnName, shortName.ObjToString()));
|
||||
|
@ -436,11 +436,16 @@ namespace SqlSugar
|
||||
{
|
||||
var key = typeName + "." + name;
|
||||
var info = readerValues.Select(it => it.Key).FirstOrDefault(it => it.ToLower() == key.ToLower());
|
||||
var oldInfo = info;
|
||||
if (mappingKeys!=null&&mappingKeys.ContainsKey(item.Name))
|
||||
{
|
||||
key = mappingKeys[item.Name]+"."+typeName + "." + name;
|
||||
info = readerValues.Select(it => it.Key).FirstOrDefault(it => it.ToLower() == key.ToLower());
|
||||
}
|
||||
if (info == null&&oldInfo!=null)
|
||||
{
|
||||
info = oldInfo;
|
||||
}
|
||||
if (info != null)
|
||||
{
|
||||
var addItem = readerValues[info];
|
||||
|
Loading…
Reference in New Issue
Block a user