How to initialize Catel in a UserControl DLL?

Topics: Questions
Apr 26, 2013 at 1:06 PM
I'm developing a wpf UserControl, and I would like to use Catel for this project. Usually (at least in the Catel Project template) in App.OnLoaded some intialization is done, like LogManager registration, StyleHelper and IoC initialization. I need to use this UserControl in a old MFC project as I've done with some other .NET components.
What is the best way to initialize the DLL (I don't think that there is a OnLoaded event for DLL)?
Coordinator
Apr 26, 2013 at 2:16 PM
The best way to do this is to write a ModuleInitializer. This is a hidden .NET feature that is great for such scenarios:

https://github.com/Fody/ModuleInit
Apr 26, 2013 at 2:43 PM
I need Fody for this to work, isn't it?
Coordinator
Apr 26, 2013 at 2:44 PM
Yep, but it really is the best way of doing this without being dependent on the caller to initialize your stuff.
Apr 26, 2013 at 2:47 PM
OK, many thanks for the tip and for this great project!!