can anyone help?
I have created a WCF library (not application) and i will be hosting this in a SVC IIS page..
But i was wanting to load the unity stuff in generic place... I could load it in the global.asax but then its tied to the IIS Asp.net container and when doing TDD this part wouldn't execute so not of my resolves would work.
WCF Library is a pure class so i doubt i can use any events like OnStartup etc?
The only way i thought of what having the service inherit from a base class as well the interface which would call a static class of some kind and do the bootstrapping for unity..
I am a little lost, is this the only way or is there some way i am unaware of.
Basically the idea is ... Who ever calls the wcf library then the unity injection needs to happen..
Any ideas?
Thanks
There are several ways of tackling this problem. Here are you two best options:
You can create a custom ServiceHost and override InitializeRuntime
You can create a class called ApplicationStart in your App_Code directory with a public static method AppInitialize (it's a bit of a smell, though):
public static class ApplicationStart
{
public static void AppInitialize()
{
// Initialise IoC container
}
}
Wenlong Dong has the other methods on his blog.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With