mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-10-15 18:55:07 +08:00
Support Select(it=>new Tupple)
This commit is contained in:
@@ -442,6 +442,16 @@ namespace SqlSugar
|
||||
var readerValues = DataReaderToDictionary(reader, tType);
|
||||
var mappingKeys = this.QueryBuilder?.MappingKeys;
|
||||
var result = new Dictionary<string, object>();
|
||||
if (UtilMethods.IsTuple(tType, classProperties))
|
||||
{
|
||||
var index = 0;
|
||||
foreach (var item in classProperties)
|
||||
{
|
||||
result.Add("Item" + (index + 1), reader.GetValue(index));
|
||||
index++;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
foreach (var item in classProperties)
|
||||
{
|
||||
var name = item.Name;
|
||||
|
@@ -18,6 +18,15 @@ namespace SqlSugar
|
||||
{
|
||||
public class UtilMethods
|
||||
{
|
||||
public static bool IsTuple(Type tType, List<PropertyInfo> classProperties)
|
||||
{
|
||||
if (classProperties?.Any() != true)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return tType.FullName?.StartsWith("System.Tuple`") == true && classProperties.FirstOrDefault()?.Name == "Item1";
|
||||
}
|
||||
|
||||
internal static string GetTableByDbLink(SqlSugarProvider context,string tableName, string oldTableName, TenantAttribute attr)
|
||||
{
|
||||
QueryBuilder queryBuilder=InstanceFactory.GetQueryBuilderWithContext(context);
|
||||
|
Reference in New Issue
Block a user