Projecting fields from a related object

Posts   
 
    
peschkaj
User
Posts: 30
Joined: 21-Sep-2006
# Posted on: 04-Jan-2007 19:03:13   

If I use a PrefetchPath to pull in related objects that are mapped 1:1, it is possible to project fields from the related objects onto a DataView?

jmeckley
User
Posts: 403
Joined: 05-Jul-2006
# Posted on: 04-Jan-2007 19:18:04   

if the relationship is 1:1 why not create a hierachy (super/sub types)? This would easily solve your DataView issues as everything is contained within 1 object. No prefetch paths needed either.

peschkaj
User
Posts: 30
Joined: 21-Sep-2006
# Posted on: 04-Jan-2007 19:32:48   

if the relationship is 1:1 why not create a hierachy (super/sub types)? This would easily solve your DataView issues as everything is contained within 1 object.

Because the relationships are all distinct data constructs in their own right.

In this case there is a Resource which is assigned to a Project, has a Role on a Project (the same role can exist on multiple projects), and can have a user associated with it.

In this case I want to pull all of the data from the resource table for a specific project, as well as pull the Project name, Role name, and user name and chunk everything in a DataView delivered by a service layer living on top of the domain layer (LLBLGen).

jmeckley
User
Posts: 403
Joined: 05-Jul-2006
# Posted on: 04-Jan-2007 19:36:34   

wouldn't that make it a 1:N relationship Role: Project? Could you use a typedlist to construct your required data and then gerenate the view from the typedlist? This will also give you the control to only retrieve the fields you require.

peschkaj
User
Posts: 30
Joined: 21-Sep-2006
# Posted on: 04-Jan-2007 19:51:24   

wouldn't that make it a 1:N relationship Role: Project? Could you use a typedlist to construct your required data and then gerenate the view from the typedlist? This will also give you the control to only retrieve the fields you require.

You are correct, I was mistaken when I said it was 1:1. I had forgotten about the possibility of a TypedList, thanks for pointing that out as a better solution.