Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Checking for child record before saving parent
Message
 
À
29/08/2011 17:17:59
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Versions des environnements
Environment:
C# 4.0
OS:
Windows Server 2003
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01522124
Message ID:
01522169
Vues:
26
>>I have a tool rental system for which I would like to avoid saving the main issue ticket until I am sure that I have at least one valid detail row. Of course, I don't want to save the detail row without a valid ticket either. I thought I could do that by making the detail row a child of the ticket but the parent rules are validated before checking the child records. Is this possible? If so, where do I put the check for existing child records? Thanks.
>
>I would consider doing as you indicated and creating a parent entity, then a child entity. When the user completes the child entity, you can call any rules on it yourself prior to saving the whole thing. Then if the child record is valid, call the save on the parent which would also save the child. If they never complete the child, then don't save anything.
>Timothy
Thanks for your help. I've got it working now. I had to eliminate the validation on the child table's foreign key.
Linda Harmes
HiBit Technologies, Inc.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform