Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Business Object in n-tier
Message
De
14/10/2000 23:57:35
 
 
À
14/10/2000 22:51:29
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00429568
Message ID:
00429571
Vues:
14
>Hi,
> I am researching about the methodolofgy of building N-Tier client server system.
> I would like to ask that:
>
>1. Where should I place the code of enforce the integrity between 2 or more tables? e.g., If I have one-many relationship tables. Once user need to delete the master record, I need to check the any exisiting child records related to the master. I should call the function (check integrity) in my Master object (e.g. customer), a new object (e.g. customerBooking), call it directly in User sevice, place it as stored procedure or define the integrity in DBMS and trap the error ??
>
>2. How about insert function as the situation above?
>
>Thank you

It depends.

1) If it's not very likely the DB you are using will change, (e.g., move from Oracle to SQL Server) - Put it in the DB.
Whether you put it in RI or stored procedures (triggers) depends on whether or not you need to restrict the particular action.
Deleting a parent (master) record may only need to be restricted if there are matching records in a particular child table. For these, put this in the RI.
For other child tables, you may want to cascade the deletion - meaning, delete the child records when the parent is deleted (provided it doesn't fail the restricted deletion RI). In that case, put this in a stored procedure.

Inserts into child tables should be restricted if there is not a match in the parent table. (At least I've never seen a reason to allow this.)
Insert restrictions should be put in the RI.

2) If it is likely the DB will change, or if it may need to be able to use a variety of DBs, I'd put the deletion restriction and/or cascades in the master object; any insert restrictions, I'd put in the child object(s).
Insanity: Doing the same thing over and over and expecting different results.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform