List of all objects in my Unity DI Container
Is there a way to have a list of all objects registered in my开发者_StackOverflow中文版 DI Container. ResolveAll gives a list for a type but I want a general list for all types
Well, you can't get a list of all objects, because objects aren't registered, types are. Unity 2.0 added the UnityContainer.Registrations property you can use to look at what's in the container.
Be warned there's a known bug right now if you have open generics registered which causes the Registrations property to throw an exception.
精彩评论