Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Should Entities refer to fields from related tables?
Message
From
01/06/2010 11:39:06
 
 
To
01/06/2010 11:07:18
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
01466424
Message ID:
01466883
Views:
32
>>>Hi Frank,
>>>
>>>>Hi,
>>>>
>>>>I have a Clients table and a Policies table. A client can have one or many policies. When displaying a single Policy I want to display some of the client details like Name and Number. Should I set Client as a child business object of Policy, or should I include the related fields in the Policy entity?
>>>
>>>
>>>My personal opinion is that Entity objects should not contain properties from other entities. You can easily once you have the policy entity, just call the client biz obj to get the specific fields for the specific record you are working with and bind those to whatever controls you are displaying in. I would guess they would need to be read only. But if the policy record navigates then you need to also re-query the client table for related values.
>>>Tim
>>
>>Thanks Tim,
>>
>>I had a gut feeling that this is the way you would suggest so I went ahead down this path.
>
>That is not to say that I never join a display field from another table, I just don't add properties to entity objects from other tables. If I need to display say the customer name and all I have is the customerID I may join it for display purposes but not if the result will be edited. Example is if I have a grid of orders and I want to display the customer name, I will just join the table and return this as a dataset. When they want to edit an order, then I retrieve the order as an entity and also retrieve an entity for the customer that goes with it.
>I hope that helps
>Tim

Thanks Tim, helpful as usual.
Frank.

Frank Cazabon
Samaan Systems Ltd.
www.samaansystems.com
Previous
Reply
Map
View

Click here to load this message in the networking platform