This is a migrated thread and some comments may be shown as answers.

where is ObjectScopeProvider1?

6 Answers 106 Views
Development (API, general questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jim
Top achievements
Rank 1
Jim asked on 25 Sep 2011, 05:56 AM
I am using version 2011.2.713.3 of OA.  There are dozens of examples in the documentation that refer to ObjectScopeProvider1, but I can not find any implementation of ObjectScopeProvider anywhere.   I have generated models as directed, but still nothing.

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

Sort by
0
Jim
Top achievements
Rank 1
answered on 25 Sep 2011, 07:00 AM
I searched the doc, kb, blogs & forums and flailed away at code for hours before posting my question.   Of course, just minutes after posting I stumbled on the answer here:

http://www.telerik.com/community/forums/orm/development/api-confusion.aspx

I am including it here so others may find it as well.
0
Ivailo
Telerik team
answered on 28 Sep 2011, 01:02 PM
Hello Jim,

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 >>

0
TuanTH
Top achievements
Rank 2
answered on 20 Jun 2012, 04:28 AM
Hi Ivailo,
How to using OpenAccessContextBase.GetScope() for transaction.

Thanks,
TTuan
0
Ralph Waldenmaier
Telerik team
answered on 20 Jun 2012, 11:47 AM
Hi HT Tuan,

You can use the following code to work with the scope and transactions.

scope.Transaction.Begin();
//Your business logic here
scope.Transaction.Commit();
You can find more details in our documentation.  

Feel free to ask if you have any other question.All the best,
Ralph
the Telerik team
OpenAccess ORM Q2'12 Now Available! Get your hands on all the new stuff.
0
Michael
Top achievements
Rank 1
answered on 30 Nov 2012, 08:22 PM
Wow. You referred him RIGHT back to where he (and I) started.

Are you saying that there is no way to support transactions explicitly without falling back to the "Classic" model?
0
Ralph Waldenmaier
Telerik team
answered on 03 Dec 2012, 08:20 AM
Hi Michael,

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.

Greetings,
Ralph
the Telerik team
Telerik OpenAccess ORM Meets ASP.NET Web API. Read more.
Tags
Development (API, general questions)
Asked by
Jim
Top achievements
Rank 1
Answers by
Jim
Top achievements
Rank 1
Ivailo
Telerik team
TuanTH
Top achievements
Rank 2
Ralph Waldenmaier
Telerik team
Michael
Top achievements
Rank 1
Share this question
or