Why won't this simple Register<> compile?

Oct 18, 2009 at 9:47 AM
//The class is defined like so....
public class CreateNewAccountHandler : ICommandHandler<CreateNewAccountCommand, CreateNewAccountResponse>
public CreateNewAccountResponse ExecuteCommand(CreateNewAccountCommand command)
throw new NotImplementedException();

//And here it the code which won't compile
static void RegisterHandlers_Account(IUnityContainer unityContainer)
>(new TransientLifetimeManager());

Error 1 The type 'TaskSmart.AppLayer.RequestHandlers.Account.CreateNewAccountHandler' cannot be used as type parameter 'TTo' in the generic type or method 'Microsoft.Practices.Unity.IUnityContainer.RegisterType(Microsoft.Practices.Unity.LifetimeManager, params Microsoft.Practices.Unity.InjectionMember[])'. There is no implicit reference conversion from 'TaskSmart.AppLayer.RequestHandlers.Account.CreateNewAccountHandler' to 'TaskSmart.AppLayer.Api.RequestHandlers.ICommandHandler'. C:\Data\TaskSmart\TaskSmart.AppLayer\UnityBootStrapper.cs 50 6 TaskSmart.AppLayer

Does anyone see why this won't compile?  I have been scratching my head for ages now and I just cannot see what is wrong with it!
SVN is here :




Oct 18, 2009 at 10:23 AM

I had accidentally copied two interface files instead of moving them.  Deleting the duplicates worked, the namespaces were very similar so I didn't spot the discrepancy :-)