Reputation: 488
I have a class library in VB.NET that does a NET-envelope for an USB device driver.
There is only one function of that driver that I could not envelope in a traditional class, but I had to put it in a Windows Service as described here: Sharing a class property (field) between applications
The Windows Service works fine, but I have now two projects for my NET-envelope: the one with the class library, the second with the windows service and I do not like the idea to maintain two distinct projects for the same driver.
Is it a good practice (or even if possible) to add a windows service class to a normal class library (without creating its own project as described in the vb tutorial)? I know, in any case I should create a separate setup only for the windows service, but in this way I could have together all the classes that envelope my usb device driver in only one project.
Upvotes: 4
Views: 1533
Reputation: 4122
I think that it depends on the size of your project. A simple service that does one thing with a minimal amount of code would be fine as a single project/EXE.
A service that calls a database, builds objects, and does reporting would be better as multiple projects (one EXE and several support DLLs).
It's a design decision, not a code decision.
Upvotes: 2