where is ObjectScopeProvider1?

7 posts, 0 answers
  1. Jim
    Jim avatar
    19 posts
    Member since:
    Feb 2008

    Posted 25 Sep 2011 Link to this post

    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?
  2. Jim
    Jim avatar
    19 posts
    Member since:
    Feb 2008

    Posted 25 Sep 2011 Link to this post

    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.
  3. DevCraft banner
  4. Ivailo
    Admin
    Ivailo avatar
    318 posts

    Posted 28 Sep 2011 Link to this post

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

  5. TuanTH
    TuanTH avatar
    4 posts
    Member since:
    Mar 2010

    Posted 19 Jun 2012 Link to this post

    Hi Ivailo,
    How to using OpenAccessContextBase.GetScope() for transaction.

    Thanks,
    TTuan
  6. Ralph Waldenmaier
    Admin
    Ralph Waldenmaier avatar
    202 posts

    Posted 20 Jun 2012 Link to this post

    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.
  7. Michael
    Michael avatar
    19 posts
    Member since:
    Oct 2011

    Posted 30 Nov 2012 Link to this post

    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?
  8. Ralph Waldenmaier
    Admin
    Ralph Waldenmaier avatar
    202 posts

    Posted 03 Dec 2012 Link to this post

    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.
Back to Top
DevCraft banner