Usage of generic OpenAccessContext

2 posts, 1 answers
  1. Hasan Oz
    Hasan Oz avatar
    11 posts
    Member since:
    Apr 2010

    Posted 31 Aug 2010 Link to this post

    Hi , I want to manually defineOpenAccessContext like this.
    string connectionString = @"data source=;initial catalog=xxx;user id=sa;password=xxx";
      XmlMetadataSource metadataSource =
               BackendConfiguration configuration = new BackendConfiguration();
               configuration.Backend = "mssql";
               OpenAccessContext context = new OpenAccessContext(
                  connectionString, configuration, metadataSource);

    My question , If I define context as a generic OpenAcessContext , how I reach to entites.
    public void GetSystem(OpenAccessContext context)
         return  context.GetAll<Systems>().FirstOrDefault   ............
    is the same with Scope.Extent<Systems>().FirstOrDefault   ........................

    () method really gets all values?
    Or is there any advice of you for usage of several context in one point. In old scope model this is easy with Extend method.
  2. Answer
    Alexander avatar
    727 posts

    Posted 01 Sep 2010 Link to this post

    Hello Hasan Özgilik,

    Yes, you can use the context.GetAll<T>() method. As you can see, the context endpoints call exactly this method which indeed calls internally scope.Extent<T>(). So the result at the end should be the same.
    Hope that helps.

    All the best,
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
Back to Top