I have a class in c# to help me log errors (ErrorClass
).
- The class has 3 methods. Log Error to: File System, Windows Event, Email.
- 2 of the 3 methods require settings like "to email", or "directory path".
- Settings are stored in the registry
- I use dependency injection to instantiate the
RegistryClass
inside theErrorClass
.
This is how I instantiate the ErrorHandle Class inside the Registry Class
ErrorHandle _ErrorHandle = new ErrorHandle();
And here is how I instantiate the Registry Class inside the ErrorHandle Class
RegistryTools _GetRegistry = new RegistryTools();
I have a class to help me retrieve values from the registry (RegistryClass
)
- The registry class needs to handle errors
- I use dependency injection to instantiate the
errorClass
inside theRegistryClass
When I use dependency injection in both classes, an Endless LOOP is created when there is an error.
What is the suggested way or best practice of handling this situation:
- Should I access the registry inside the
ErrorClass
? - Should I not ErrorHandle the
RegistryClass
? - Should I create a separate ErroHandle procedure for the
RegistryClass
?