More in this section
Forums / Sitefinity SDK / Unknown method GetScope of OpenAccessDataProvider

Unknown method GetScope of OpenAccessDataProvider

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
3 posts, 1 answered
  1. Drew Greenwell
    Drew Greenwell avatar
    66 posts
    Registered:
    11 Feb 2010
    25 Apr 2011
    Link to this post
    Ive upgraded to 4.1 and I've updated my Products Module code to match the code from Slavo's post here. 
    http://www.sitefinity.com/blogs/slavoingilizov/posts/11-04-07/changes_in_mapping_persistent_classes_in_custom_modules_with_sitefinity_4_1.aspx

    After correcting the fact that ProductsFluentMetaDataSource attempts to override a non existent method and stubbing out the new members that were added to the ILocatable interface, I noticed that anywhere that scope is accessed through this.GetScope a compilation error occiurs 

    Unknown method GetScope of OpenAccessDataProvider
    GetScope is still there, but it's been marked internal :/
    So now this code here no longer works.. Can someone tell me how these operations changed with the latest version of OpenAccess?
    // Always use this method. Do NOT change it to query. Catch the exception if the Id can be wrong.
      var productItem = this.GetScope().GetItemById<ProductItem>(id.ToString());
      ((IDataItem)productItem).Provider = this;
      return productItem;
  2. Duneel
    Duneel avatar
    166 posts
    Registered:
    08 Dec 2010
    25 Apr 2011
    Link to this post
    Hello Drew,

    You need to use this.GetContext() instead.

    Cheers,
    Duneel
    Answered
  3. Drew Greenwell
    Drew Greenwell avatar
    66 posts
    Registered:
    11 Feb 2010
    25 Apr 2011
    Link to this post
    Thanks, that got it

    // Always use this method. Do NOT change it to query. Catch the exception if the Id can be wrong.
               var productItem = this.GetContext().GetItemById<ProductItem>(id.ToString());
               ((IDataItem)productItem).Provider = this;
               return productItem;
3 posts, 1 answered