Projection and DTO with a collection type field

Posts   
 
    
prabhu
User
Posts: 77
Joined: 20-Dec-2006
# Posted on: 01-Nov-2007 08:39:07   

Hi,

In our project for transporting data between the client and service we are using DTO objects.For populating the dto using projections available in llbl.

In my scenario i am designed a DTO class with the following hierarchial structure.

[DataContract] public class PlanTree { private int activityId; private int personId; private DateTime planDate; private List<PersonPerLocation> collPersonLocation = null;

    [DataMember]
    public int ActivityId
    {
        get { return activityId; }
        set { activityId = value; }
    }

    [DataMember]
    public int PersonId
    {
        get { return personId; }
        set { personId = value; }
    }

    [DataMember]
    public DateTime PlanDate
    {
        get { return planDate; }
        set { planDate = value; }
    }

    **[DataMember]
    public List<PersonPerLocation> CollPersonLocation
    {
        get { return collPersonLocation; }
        set { collPersonLocation = value; }
    }**
}

[DataContract] public class PersonPerLocation { private int personId; private int personLocationId; private string personName; private string locationName;

    [DataMember]
    public int PersonId
    {
        get { return personId; }
        set { personId = value; }
    }

    [DataMember]
    public int PersonLocationId
    {
        get { return personLocationId; }
        set { personLocationId = value; }
    }

    [DataMember]
    public string PersonName
    {
        get { return personName; }
        set { personName = value; }
    }

    [DataMember]
    public string LocationName
    {
        get { return locationName; }
        set { locationName = value; }
    }
}.

Is it possible to project data into the above structure since i am having a list of personlocations collections as an field inside the PlanTree dto. Please let me know how to proceed on this scenario instead of using EntityCollection option.

Regards

Prabhu

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 01-Nov-2007 09:57:33   

As far as I know, that's not currently supported out of the box. In LLBLGen Pro 2.5 you can project a Hierarchy/graph to a DataSet or a Dictionary.

You'll have to use a custom routine to copy the graph to those custom classes.

prabhu
User
Posts: 77
Joined: 20-Dec-2006
# Posted on: 01-Nov-2007 10:57:14   

Thanks walaa for the response. So in LLBLGen 2.5 version also we cant able to project a hierarchy/graph to a custom object instead of Dataset and Hashtable.

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 01-Nov-2007 11:11:45   

unfortunatly not.