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

Usage of generic OpenAccessContext

1 Answer 98 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.
Hasan Oz
Top achievements
Rank 1
Hasan Oz asked on 31 Aug 2010, 09:23 AM
Hi , I want to manually defineOpenAccessContext like this.
string connectionString = @"data source=192.168.5.217;initial catalog=xxx;user id=sa;password=xxx";
 
  XmlMetadataSource metadataSource =
              XmlMetadataSource.FromAssemblyResource(
                  Assembly.LoadFrom("BIS.Business.MainApplication.dll"),
                  "BisFrameworkEntityDiagram.rlinq");
 
           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   ........................

GetAll
() 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.
Thanks.

1 Answer, 1 is accepted

Sort by
0
Accepted
Alexander
Telerik team
answered on 01 Sep 2010, 09:06 AM
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,
Alexander
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
Tags
Development (API, general questions)
Asked by
Hasan Oz
Top achievements
Rank 1
Answers by
Alexander
Telerik team
Share this question
or