Skip to content

Commit

Permalink
- 修复 DbContext TrackList 对匿名对象处理的 bug;#150
Browse files Browse the repository at this point in the history
  • Loading branch information
28810 authored and 28810 committed Dec 8, 2019
1 parent dee1d9a commit 65e3ed0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions FreeSql.DbContext/DbSet/DbSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ internal void TrackToList(object list)
var itemType = item.GetType();
if (itemType == typeof(object)) return;
if (itemType.FullName.StartsWith("Submission#")) itemType = itemType.BaseType;
if (_db.Orm.CodeFirst.GetTableByEntity(itemType) == null) return;
var dbset = _db.Set(itemType);
dbset?.GetType().GetMethod("TrackToList", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(dbset, new object[] { list });
return;
Expand Down
7 changes: 7 additions & 0 deletions FreeSql.DbContext/FreeSql.DbContext.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions FreeSql.Tests/FreeSql.Tests.DbContext/UnitTest1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ public void Include_ManyToMany()
using (var ctx = g.sqlite.CreateDbContext())
{

var test150 = ctx.Set<Tag>()
.Select.From<Tag>((s, b) => s.InnerJoin(a => a.Id == b.Id))
.ToList((a, b) => new
{
a.Id,a.Name,
id2 = b.Id, name2 = b.Name
});

var songs = ctx.Set<Song>().Select
.IncludeMany(a => a.Tags)
.ToList();
Expand Down

0 comments on commit 65e3ed0

Please sign in to comment.