Hi voulgeor,
No problem. You can set the DefaultEntityReferenceStrategy for the EntityManager:
manager.DefaultEntityReferenceStrategy = New EntityReferenceStrategy(EntityReferenceLoadStrategy.DoNotLoad, MergeStrategy.OverwriteChanges)
or for the EntityType:
Item.PropertyMetadata.ItemDescriptions.ReferenceStrategy = New EntityReferenceStrategy(EntityReferenceLoadStrategy.DoNotLoad, MergeStrategy.OverwriteChanges)
or even for the given entity only: (by setting GetEntityReference.IsLoaded to true)
Item.PropertyMetadata.ItemDescriptions.GetEntityReference(item).IsLoaded = True
Then can still use your same query to retrieve item and once you have it, you can query for the itemdescription given the languageid criteria.
This way you can navigate to Item.ItemDescriptions and will only retrieve the itemdescription matching the languageid given (since it's the only one in cash and we are not accessing the datasource)
Another way, maybe simpler, would be to filter the navigation property as you retrieve it:
Dim itemdescriptions = item.ItemDescriptions.Where(Function(id) id.LanguageId == languageid)
Regards,
Silvio.
Edited by sbelini - 19-Jan-2012 at 3:56am