I use
Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\MyProgram"
As a way to store multiple files used by my program. I would like to avoid pasting the same piece of code throughout my application.
I need to make sure that:
- The path cannot be accidentally changed after installation
- The classes he needs have access to him.
I thought:
- Make him single
- Using constructor dependency injection
- Using Property Dependency Injection
- Using AOP to create a path where necessary.
Each has its pros and cons.
Singleton is all his favorite boys. I am not against using one, but there are good reasons to avoid it, if possible.
Castle Windsor. , Windsor . , - , . , .
, , , , , . , , .
AOP , AOP , .
, ? , ?