Question

I just downloaded Unity 3 to give it a try for my new project. The documentation states that this version allows Registration by Convention using the container.RegiserTypes method. But I cannot find this method anywhere. Am I missing an additional DLL? I used Nuget to add Unity 3 to my project.

Était-ce utile?

La solution 2

How did you get the DLLs and are you sure you have the correct version of Unity? I added the dependency using Nuget and it worked once Microsoft.Practices.Unity was included. Version is 3.0.0. RegisterTypes is an extension method defined in UnityContainerRegistrationByConventionExtensions which may be the cause of your issue if you just added a reference to IUnityContainer and UnityContainer.

enter image description here

Autres conseils

As of this answer the version of Unity out there is version 5.* . If you realize your version is version 5.0 or higher, none of the above answers will apply to you because Registration By Convention is no longer distributed with Unity Core.

Unity has been broken down into a set of Packages for you to install only what you need.

If you need to do Registration By Convention - which is what the RegisterTypes() method is used for, you need to also install the NuGet Package, Unity.RegistrationByConvention (version 2.1.0 as of this writing).

Once you install it, you will have the RegisterTypes() method back.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top