Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Should Entities refer to fields from related tables?
Message
De
29/05/2010 10:04:46
 
 
À
28/05/2010 17:08:45
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Divers
Thread ID:
01466424
Message ID:
01466495
Vues:
46
>>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform