RegisterType generic extension missing

Topics: Prism v2 - Silverlight 4
Nov 4, 2010 at 1:27 PM

Hi,

 

I downloaded v2.2 for SL 4, built the binaries and using it.

I'm trying to register a few components on the ConfigureContainer method in my Bootstrapper. However when I try to do this

Container.RegisterType<IInterface, MyClass>();

i get the below error. Looks like this extension is missing.

Error 1 The non-generic method 'Microsoft.Practices.Unity.IUnityContainer.RegisterType(System.Type, System.Type, string, Microsoft.Practices.Unity.LifetimeManager, params Microsoft.Practices.Unity.InjectionMember[])' cannot be used with type arguments 

Am I missing something here?

 

Nov 4, 2010 at 8:17 PM

Hi,

As the RegisterType<TFrom, TTo> method is an extension method located in the UnityContainerExtensions class, you must add the following using in your class:

  • Microsoft.Practices.Unity

Hope this helps.

Fernando Antivero
http://blogs.southworks.net/fantivero

Nov 5, 2010 at 3:19 PM

Is that a silverlight build? It doesnt seem to be there when I build the composite library project.  I only see Microsoft.Practices.Unity.Silverlight.

Nov 5, 2010 at 5:37 PM

Hi,

Sorry you are right, I provided you the wrong using. Based on your response, I checked it again in the Silverlight version. So you could try with the following using:

  • using Microsoft.Practices.Composite.UnityExtensions;

Hope this helps.

Fernando Antivero
http://blogs.southworks.net/fantivero

Nov 6, 2010 at 5:37 AM

Hi,

I have that using in place already. Its very strange that it still doesnt seem to like it :( . Very strange !

Nov 8, 2010 at 12:36 PM

Hi,

I would recommend you to check the following HelloWorld Quickstart, which is part of the Prism release that you downloaded. This way you could make a comparison between the Quickstart and your project, by checking  project's references as well as the using(s).

Hope this helps.

Fernando Antivero
http://blogs.southworks.net/fantivero