Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Proper way to stop New() execution
Message
From
31/10/2006 04:11:57
Alexandre Palma
Harms Software, Inc.
Alverca, Portugal
 
 
To
30/10/2006 21:25:05
General information
Forum:
ASP.NET
Category:
Class design
Environment versions
Environment:
VB 8.0
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01165405
Message ID:
01165729
Views:
11
I would say what I did before raise the exception on the new and then trap that exception on the caller and do the redirect there.


>>If you have code that needs to exit during construction you probably have a design flaw <s>...
>
>Well, the New() event of the object defines a lot of properties. But, to define one of those properties, I need to execute a SQL command. In one particular circumstance, it may be that the SQL command would return no record. If that is the case, I need to redirect to another page with a message. But, doing a redirect inside a New() constructor will not work. So, what I do is that I initialize a property lStop to True and use that later on.
>
>What would you recommend to enhance that design?
Alexandre Palma
Senior Application Architect
Previous
Reply
Map
View

Click here to load this message in the networking platform