Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Proper way to stop New() execution
Message
De
30/10/2006 21:25:05
 
Information générale
Forum:
ASP.NET
Catégorie:
Conception classe
Versions des environnements
Environment:
VB 8.0
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01165405
Message ID:
01165695
Vues:
13
>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?
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform