mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 10:42:52 +08:00
fix: 无构造函数的对象不跟踪(基本上都是dto对象)
无构造函数的对象不跟踪(基本上都是dto对象),ISelect的ToList和First对象如果没有空的构造函数,则会在CreateEntityState的时候引发异常
This commit is contained in:
parent
ef69eba405
commit
78a840bd99
@ -100,6 +100,7 @@ namespace FreeSql
|
||||
if (itemType == typeof(object)) return;
|
||||
if (itemType.FullName.Contains("FreeSqlLazyEntity__")) itemType = itemType.BaseType;
|
||||
if (_db.OrmOriginal.CodeFirst.GetTableByEntity(itemType)?.Primarys.Any() != true) return;
|
||||
if (itemType.GetConstructor(System.Type.EmptyTypes) == null) return;
|
||||
var dbset = _db.Set(itemType);
|
||||
dbset?.GetType().GetMethod("TrackToList", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(dbset, new object[] { list });
|
||||
return;
|
||||
|
Loading…
x
Reference in New Issue
Block a user