Synchronization code

This commit is contained in:
sunkaixuan 2024-06-15 12:11:03 +08:00
parent c89f6a98e4
commit 9aea119161
2 changed files with 19 additions and 0 deletions

View File

@ -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;

View File

@ -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);