I have several entities that implement IModel interface. I want to get records from all tables whose entities implement this interface. Is it possible?
I found a solution:
context.ObjectStateManager
.GetObjectStateEntries(EntityState.Added /* All states here */)
.Select(e => e.Entity)
.OfType<IModel>()
.ToList();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With