Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Best practice on Foreign Keys
Message
De
19/02/2009 14:29:58
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
 
 
À
19/02/2009 13:58:57
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Versions des environnements
Environment:
ASP.NET
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01382748
Message ID:
01382960
Vues:
30
Hi Shawn,

>>The business objects are related when you call the RegisterChildBizObj method of the parent. If you look in the jump start for Web Forms >Application C# under step 12 step 4 you will see the following code in the page_load event that registers the OrderDetail as a child of the >Order business object.
>
>I read about the RegisterChildBizObj, but it was never clear what occured during a select of the parent records it only discussed that records were affected on Add, Delete and modify in a cascading down effect and back up in the case of rule violations.
>
>How would a child business object work in the case of a Crew readonly page where I want the CrewType field to display the CrewType.TypeName and not the Crew.CrewTypeFK. Will I need to call Crew.GetRecordByPK( int crew ) and then make a call to CrewType.GetRecordByPK ( Crew.CreTypeFK )? Then the CrewType textbox properties would be BindingSource: CrewType BindingSourceMember: TypeName?

This really depends on what you are doing in your UI with the data. Since a CrewType suggests to me this is a single record that displays the type of Crew and not a one to many type relationship I think you have several options but a couple of them stand out to me.
If the UI is for display purposes only and not going to be edited I would probably just add a join in my Crew select statement and retrieve the TypeName field with the Crew data. This will not however give you any insert or update capability on this field.

If you need to have this field updateable then it is best to retrieve all those records from the CrewType table seperately and use something like the previous example I showed you. If you are going to put these in a combo box for the user to change it (or select it for a new record) then my previous example and the one used in the jump start works very well. There are other ways of course to show or pick the record as well as display the corresponding record. The controls you use and how you want your users to select a type would affect the best methods to use.

I might be able to be more specific if you can describe specifically how you want your users to select or edit this field and the controls you plan to use for this data assuming it is all editable. Also if you are having a road block with any of this and need help via GoToMeeting to get past that, just let me know.
Tim
Timothy Bryan
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform