Reputation: 1918
I try to pass a Unity container instance to an AppDomain but i get a SerialisationException
for the UnityContainer
.
Is there any solution to past multiple objects from host to an plugin/AppDomain without to past every single element in the constructor of the AppDomain.
Greetings
Upvotes: 0
Views: 1156
Reputation: 172646
You can't -and shouldn't- pass your DI container from App Domain to app domain. That doesn't make sense, since the DI container would resolve instances that are defined, known, and cached within that app domain and even when the container would be moved across AppDomains, you would have to make sure that all your registrations are movable as well.
Instead you should either make sure that everything is running in the same AppDomain, or create one container per App Domain.
Upvotes: 1