Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有几个实现 IModel 接口的实体。我想从其实体实现此接口的所有表中获取记录。是否可以?
我找到了一个解决方案:
context.ObjectStateManager .GetObjectStateEntries(EntityState.Added /* All states here */) .Select(e => e.Entity) .OfType<IModel>() .ToList();