MattNorman
Well-known member
- Joined
- May 22, 2021
- Messages
- 98
- Programming Experience
- 1-3
I am currently in the process of writing some Windows Services to replace logic that is currently done within a WPF app.
There will be several service projects and a class library project for utilities/helpers.
I am having some issues figuring out the best way to structure the class library and at the moment it has circular dependencies causing stack overflows.
I am struggling to understand how to strip out the dependencies to resolve this while maintaining the functionality that I need.
An example of one of the dependencies is as follows:
Windows Service -> DataManagerLogs -> DataHelper -> RegistryManager -> DataManagerLogs
DataManagerLogs: Contains methods for logging to database
DataHelper: Contains methods for getting database connection info
RegistryManager: Contains methods for getting settings from registry
The RegistryManager ultimately loops back to creating a DataManagerLogs class as it needs to log errors itself.
In the WPF app these were all static classes however I have now changed them to non-static so that each windows service can spawn their own instances for logging to different files etc.
Can anyone offer any advice on how I can restructure this?
There will be several service projects and a class library project for utilities/helpers.
I am having some issues figuring out the best way to structure the class library and at the moment it has circular dependencies causing stack overflows.
I am struggling to understand how to strip out the dependencies to resolve this while maintaining the functionality that I need.
An example of one of the dependencies is as follows:
Windows Service -> DataManagerLogs -> DataHelper -> RegistryManager -> DataManagerLogs
DataManagerLogs: Contains methods for logging to database
DataHelper: Contains methods for getting database connection info
RegistryManager: Contains methods for getting settings from registry
The RegistryManager ultimately loops back to creating a DataManagerLogs class as it needs to log errors itself.
In the WPF app these were all static classes however I have now changed them to non-static so that each windows service can spawn their own instances for logging to different files etc.
Can anyone offer any advice on how I can restructure this?