Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Referential Integrity
Message
From
15/04/2009 11:50:50
 
 
To
15/04/2009 08:44:22
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Environment versions
Environment:
C# 3.0
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01394872
Message ID:
01394995
Views:
65
Hi Randy,

Thanks for your reply. In the application I am developing I must maintain a history of all transactions. If a customer (parent) has ever purchased anything (children) from the company, then the customer's record cannot be deleted. If however we have a customer (parent) record and that customer has never purchased anything from the company, then that customer record can be deleted. Your approach to always cascade deletes would maintain referential integrity but would not fulfill the requirement for this application.

The existing HookPreDelete() method is in the mmBusinessForm class and its only passed parameter is the DataRow to delete. With only that piece of information, how would I iterate through the childbizobj collection?

Sam

>Hi Sam,
>At my company framework level business object, I've set the Auto settings to true because that's just the way I think about objects. If a child is registered with a parent, then it should delete it's children when a parent deletes, etc. This removes the possibility of orphaned records. Setting it at the company framework level sets this as the default behavior for everyone.
>
>As far as not deleteing because some children have records, I'm not sure why you would do this, but you may have a situation where you need to. Like you said, in the HookPreDelete(), you can iterate through the childbizobj collection and see if they have any records and return false if they do.
>
>HTH,
>Randy
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform