Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Inheritance for application class
Message
De
23/12/2005 13:18:24
 
Information générale
Forum:
ASP.NET
Catégorie:
Conception classe
Divers
Thread ID:
01079712
Message ID:
01080600
Vues:
10
>I've been writing a bunch of little programs in vb over the past few months. These are console applications that do very specific tasks as part of a larger, distributed system.
>
>I too was facing these problems, especially because there is functionality that is common to all these components.
>
>One approach that SEEMED to work was as follows:
>
>In the Module1, outside of any code, and before anything else (which has global scope), I define an app object as follows:
Public oApp as new Application
Then in main(), I only have ONE line of code:
oApp.Start()
Then there's a MyMain function in Module1 which is where I put all the code that would normally go in main().
>
>The Application class is defined somewhere else and looks as follows:
Class Application
>   public oError as New ErrorHandler 'Defined elsewhere
>   public oLog as new Log, oEmail as new '.... you get the idea
>
>   Sub Start()
>      myMain() 'the myMain function is defined in Module1 and that
>               'is where my app actually starts.
>   end sub
>end class
With this approach I have access to any app-specific functionality (i.e. oApp.oLog.Echo("This will appear in the log")).

Yes, I have this application class since a year. But, it doesn't get any inheritance from the My namespace MyApplication component. The goal here is to benefit of that so I can wire up the events such as defining my own Startup() event and be able to put my own code is there. Another use is to benefit of the StartupNextInstance(), define for my own needs, which I can have at the framework level and don't bother to set it up in each project.
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
Répondre
Fil
Voir

Click here to load this message in the networking platform