Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Should Entities refer to fields from related tables?
Message
From
29/05/2010 10:04:46
 
 
To
28/05/2010 17:08:45
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
01466424
Message ID:
01466495
Views:
45
>>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?
>
>If you have required relations set in database then when you use the EF designer it adds the navigational properties and you would simpky say for example:
>
>
Policy oPolicy = db.Policies.Single( p => p.Id == policyId );
>Client c = oPolicy.Client;
>
>or the other way:
>
>
Client c = db.Clients.Single( c =>c.Id clientId);
>foreach(var policy in c.Policies) {//...}
>
>Update: Discard. I din't notice it was mm section.
>Cetin

No problem Cetin :)
Frank.

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

Click here to load this message in the networking platform