Basic one to many retrieval

Thread is closed for posting
2 posts, 0 answers
  1. Mark
    Mark avatar
    1 posts
    Member since:
    Nov 2011

    Posted 19 Feb 2012 Link to this post

    Apologies if this has been answered before or seems trivial, but I can't seem to get it to work.  I tried reading the docs and search also with nothing yet, but some confusing tidbits about FetchPlans and IsManaged and the like.  I haven't seen a single step-by-step for what seems like a common task.

    Basically in EF 4 using WCF RIA for a Silverlight app, it defines 1:many relationships as an EntityCollection in metadata and if you add an [Include] plus an .Include() statement in the domain service retrieval query it pulls down this info.

    public partial class Clinic
            public EntityCollection<Location> Locations { get; set; }
    and in the domain service:
    public IQueryable<Clinic> GetClinics()
           return DataContext.Clinics
    and this works great. How do I do this in OpenAccess?? I tried setting the IsManaged property to true in the .rlinq file for the relation, and a metadata attribute, but it doesn't like the [Include]. What else do I need to do to make this just work and also reference in the Silverlight code as clinic.Locations?
  2. PetarP
    PetarP avatar
    754 posts

    Posted 22 Feb 2012 Link to this post

    Hello Mark,

    You will need to add the association attribute as well. That will instruct our code generation to generate the required collection on your client side. Here is an example on how to do so:
    public partial class EmployeeTerritory
    internal sealed class EmployeeTerritoryMetadata
     [Association("Territory", "TerritoryID", "TerritoryD")]
     public Territory Territory { get; set; }

    the Telerik team
    Telerik OpenAccess ORM Q1 2012 release is here! Check out what's new or download a free trial >>
Back to Top