mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-04-24 18:04:52 +08:00
Mapper BUG
This commit is contained in:
parent
80f9db103e
commit
4dd0c2e729
@ -1185,6 +1185,7 @@ namespace SqlSugar
|
||||
var mapperCache = new MapperCache<T>(list, this.Context);
|
||||
foreach (T item in list)
|
||||
{
|
||||
mapperCache.GetIndex = 0;
|
||||
this.MapperActionWithCache(item, mapperCache);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Text;
|
||||
|
||||
namespace SqlSugar
|
||||
@ -10,6 +11,7 @@ namespace SqlSugar
|
||||
private Dictionary<string, object> caches = new Dictionary<string, object>();
|
||||
private List<T> _list { get; set; }
|
||||
private ISqlSugarClient _context { get; set; }
|
||||
public int GetIndex { get; set; }
|
||||
private MapperCache()
|
||||
{
|
||||
}
|
||||
@ -20,7 +22,8 @@ namespace SqlSugar
|
||||
}
|
||||
public Result Get<Result>(Func<List<T>, Result> action)
|
||||
{
|
||||
string key = "Get" + typeof(Result) + action.GetHashCode().ToString();
|
||||
GetIndex++;
|
||||
string key = "Get" + GetIndex;
|
||||
if (caches.ContainsKey(key))
|
||||
{
|
||||
return (Result)caches[key];
|
||||
@ -32,6 +35,10 @@ namespace SqlSugar
|
||||
return result;
|
||||
}
|
||||
}
|
||||
private static Expression<Func<List<T>, Result>> FuncToExpression<Result>(Func<List<T>, Result> f)
|
||||
{
|
||||
return x => f(x);
|
||||
}
|
||||
public List<Result> GetListByPrimaryKeys<Result>(Func<T, double?> action) where Result : class, new()
|
||||
{
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user