Andrew Stephens
Andrew Stephens

Reputation: 10203

CRM 2013 retrieve related entities using LINQ?

I'm retrieving account entities using code like this:-

var connection = CrmConnection.Parse(ConnectionString);

using (var orgService = new OrganizationService(connection))
{
    var context = new MyOrganizationServiceContext(orgService);

    var accounts = context.AccountSet.Where(...);
}

None of the returned accounts' relationship properties are populated (understandable, as this could result in lots of data being retrieved). Is there any way of requesting that certain relationships be populated, either as part of the LINQ query, or afterwards (e.g. on an entity-by-entity basis)?

Upvotes: 0

Views: 2664

Answers (1)

Guido Preite
Guido Preite

Reputation: 15138

you have a couple of options. Here the relevant MSDN article:

Access entity relationships

Upvotes: 1

Related Questions