Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Windows Service inside a dll
Message
De
04/09/2013 12:12:12
 
 
À
04/09/2013 09:31:06
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01581841
Message ID:
01582138
Vues:
42
Well, I see from the other thread that you've got it working, so I guess it doesn't matter anymore.

But what I couldn't understand is why you didn't have one class that *acted* like ServiceBase, but wasn't inherited from ServiceBase. It would have virtual/shared methods (like the ones you needed to use and override in your sub-classes). Then, your sub-classes, instead of inheriting from ServiceBase, would simply be inheriting from your "mock" ServiceBase class. It seems to me that that would have worked just the way you needed it to with minimal changes to your existing sub-classes (just change what they inherit from and the rest would be exactly the same).

~~Bonni


>>The only thing in our application that is inherited from ServiceBase is the MyService class in the EXE, as I showed. This starts up everything else in its OnStart() method ... "everything else" are just regular old classes, none of which are inherited from ServiceBase. And we have more than one. They are all instantiated and started here. And they really don't need to be inherited from ServiceBase ... that is my point. If you need threading and stuff like that, you can put that in your classes. What is so special in the ServiceBase class that you need for your classes? In other words, why do your classes need to inherit from ServiceBase?
>
>It is to benefit of overrides and overloads such as mentioned in the other message I just wrote. It implies to do things in reverse.
>
>>If all your classes get started from the one ServiceBase sub-class in the EXE, and if they themselves do not inherit from ServiceBase (but are just plain classes), then you won't any problem moving the classes up into your Framework.
>
>Yes, that is what I have now. But, each Windows Service application have some custom initialization code, some custom initialization code for every loop of the process and some custom methods. That is why this is called from the framework as they are hooks. That is why I was looking for a while to encapsulate all that into one single class that would allow me to do that. But, for now, it seems that is the only way to do it.
>
>Thanks
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform