I have some very quick Unity questions. I am implementing a very basic scenario where I am passing in the interface implementation to a Service class.
MyService service = new MyService(myContainer.Resolve<ITestRepository>());
I have the code working however, I have to ensure that the myContainer is initialised with the values loaded from the config file. Now I can understand that I can use the singleton pattern here and always return an initalised instance of the container.
Is that the best way? Do I have to keep a reference of the UnityContainer and always use that?
Finally, I read somewhere that if the pluggable architecture is not required then it is best to register the types in code. Is that correct? Is loading from the config that slow?