Entity Framework: Re-finding objects recently added to context

前端 未结 7 673
感情败类
感情败类 2020-11-30 03:53

I am using the entity framework and I\'m having a problem with \"re-finding\" objects I just created... basically it goes like this:

string theId = \"someId         


        
相关标签:
7条回答
  • 2020-11-30 04:16

    You have a number of options. You could extend the ObjectContext with another partial class to make your own mechanism for retrieving recently Added information.

    Or you could just put an extension method on the ObjectContext that looks through the ObjectContext.ObjectStateManager looking for 'added' ObjectStateEntries, and then use LINQ to Objects to find what you are looking for.

    0 讨论(0)
提交回复
热议问题