Closing an EDM ObjectContext?
I am getting started with the ADO.NET Entity Framework 4.0. I have created an EDM and data store for the app, and it successfully retrieves entities. The application holds the EDM's ObjectContext
as a member-level variable, which it uses to call ObjectContext.SaveChanges()
. So far, so good.
I am going to refactor to repositories later. Right now, my question is a bit more 开发者_运维知识库basic: When I am finished with the EDM, what do I need to do to release it? Is it as simple as calling Dispose()
on the ObjectContext
?
Yes, calling dispose on the ObjectContext is sufficient to dispose of the resources.
精彩评论