Reputation: 26940
I have several entities that implement IModel interface. I want to get records from all tables whose entities implement this interface. Is it possible?
Upvotes: 3
Views: 195
Reputation: 26940
I found a solution:
context.ObjectStateManager
.GetObjectStateEntries(EntityState.Added /* All states here */)
.Select(e => e.Entity)
.OfType<IModel>()
.ToList();
Upvotes: 2