Entity framework 选择特定entityState的Poco类列表

Entity framework 选择特定entityState的Poco类列表,entity-framework,ef-code-first,change-tracking,Entity Framework,Ef Code First,Change Tracking,我有一个软件正在向上下文添加条目。 我想使用changetracker生成一个Poco类列表,用于报告目的 像这样: List<customRecord> addedRecords = context.ChangeTracker.Entries<customRecord>().Where(e => e.State == EntityState.Added).ToList(); List addedRecords=context.ChangeTracker.Entr

我有一个软件正在向上下文添加条目。 我想使用changetracker生成一个Poco类列表,用于报告目的

像这样:

List<customRecord> addedRecords = context.ChangeTracker.Entries<customRecord>().Where(e => e.State == EntityState.Added).ToList();
List addedRecords=context.ChangeTracker.Entries()。其中(e=>e.State==EntityState.Added.ToList();
结果是以下错误:

Cannot implicitly convert type 'System.Collections.Generic.List<System.Data.Entity.Infrastructure.DbEntityEntry<T>>' to 'System.Collections.Generic.List<T>'
无法将类型“System.Collections.Generic.List”隐式转换为“System.Collections.Generic.List”
有什么办法可以做到这一点吗

问候。

添加
。选择(i=>i.Entity)

List addedRecords=context.ChangeTracker.Entries()。其中(e=>e.State==EntityState.Added)。选择(i=>i.Entity.ToList();
List<customRecord> addedRecords = context.ChangeTracker.Entries<customRecord>().Where(e => e.State == EntityState.Added).Select(i => i.Entity).ToList();