I want to use OQL and the documentation reads:
IObjectScope scope = ObjectScopeProvider1.GetNewObjectScope();
What is the correct way to instantiate an IObjectScope object?
6 Answers, 1 is accepted
http://www.telerik.com/community/forums/orm/development/api-confusion.aspx
I am including it here so others may find it as well.
Just to sum up and to avoid any misunderstanding for the future readers of this thread:
- The IObjectScope is a part of the old API of Telerik OpenAccess ORM, also referred to as Classic API.
- In the new Domain Model-based API (actually the underlying object is OpenAccessContext), there is no support for OQL.
- Since the new API is built based on the Classic API, the scope is wrapped in the OpenAccessContextBase and can be exposed through the method OpenAccessContextBase.GetScope(). This way you can benefit from the Visual Designer and the Domain Model and still use OQL.
- In general, we recommend usage of LINQ on our OpenAccessContext rather than OQL on the old IObjectScope.
Do not hesitate get back to us if you need any clarification or further details on the subject.
Greetings,
Ivailo
the Telerik team
Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's SQL Server Community Awards. We are competing in TWO categories and every vote counts! VOTE for Telerik NOW >>
You can use the following code to work with the scope and transactions.
scope.Transaction.Begin();
//Your business logic here
scope.Transaction.Commit();
Feel free to ask if you have any other question.All the best,
Ralph
the Telerik team
Are you saying that there is no way to support transactions explicitly without falling back to the "Classic" model?
Explicit transaction are only exposed via the Classic API. Please see this documentation for details to work with transactions in our new API.
Basically when you create a new Context object, then a transaction is started automatically. This generated transaction can be controlled via the SaveChanges or ClearChanges methods.
I hope this information is helpful for you.
Do come back in case you need further assistance.
Ralph
the Telerik team