Today we had a great turn out for the Q1 2010 What’s New in OpenAccess, and JustCode webinar. However, we got a great deal of questions at the end so I am going to do my best to cover all of these questions here on my blog :) This entry will aim to better explain the context object you saw me use in the webinar, and hopefully clarify a few things for everyone. The first couple of question I want to answer are below.
Currently, if you want to use forward mapping you will still have an ObjectScopeProvider in your DAL project. However, if you are doing reverse mapping, and create a new “Telerik OpenAccess Domain Model” then you will be using the new OpenAccessContext object. There are a few things to keep in mind when using the new context object. The first being, that under the covers the new context object does use IObjectScope. It is hidden from you, and wrapped up in a pretty, easy to use package, but you do still need to dispose of your context object when you are done :) You do not need to create an object scope manually however.
No, you still must commit any changes to the database with the .SaveChanges() method of the OpenAccessContext . If you are not seeing this method, then make sure you have added a reference to: Telerik.OpenAccess.35.Extensions.dll
When you use the “Telerik OpenAccess Domain Model” yes, this context object will be created for you, and this is what you will use to access your data.
I hope this helps clear up a few things. We will be getting some videos together soon that will further illustrate the use of the new features. I am currently creating a simple web project that will show a few examples of using the OpenAccessContext object. So stay tuned :)
Subscribe to be the first to get our expert-written articles and tutorials for developers!
All fields are required