Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

If you create a DomainService, exposing an entity, can you access aggregate entities?

Say you create an RIA DomainService and you include a Person (shown below) entity in it, can you access aggregate entities on that object?

For instance, if I have entities like so (keep in mind that this is a naive representation, they are modeled via the EF4 designer):

public class Person
{
    string FirstName { get; set; }
    PhoneNumber { get; set; }
}

public class PhoneNumber
{
    public string AreaCode { get; set; }
    public string Trunk { get; set; }
    public string Number { get; set; }
}

If I include Person when creating the PeopleDomainService, can the client access the PhoneNumber on it (and modify it)?

like image 562
Steven Evers Avatar asked Dec 06 '25 15:12

Steven Evers


1 Answers

You can decorate the PhoneNumber attribute of the Person object with the [Include] attribute. Remember also to include an include statement in your LINQ query when you get a Person object.

like image 148
Rus Avatar answered Dec 08 '25 05:12

Rus