is there a way to tell Unity, to build up singletons and resolving dependencies at configuration time?
Maybe using application code or Xml-Configuration.
I want to host an instance of a type as singleton in den UnityContainer, but i don´t want to
call Resove() or Resolve<T>() to build up the singleton. Because in my application code
i do not need an instance of that type.
The type i want to use and host as singleton, has dependencies to other types, but no type
has a dependency to that type.
You can do it via the API, but not from the config file. All you need to do is:
IUnityContainer container = ... set up container here ...
Out of curiousity, why do you want to manage it outside the container? You could just do:
Set it as container controlled lifetime and everything just works. Something must have a dependency on that type, otherwise, why do you have it at all?
ErrorLogService is a singleton:
1- In typeAlias define what is a singleton
2- Set the lifetime element to singleton (the name matching with the singleton definition in 1) in your Component
<!-- Lifetime manager types -->
<lifetime type="singleton" />