Search code examples
c#asp.net-mvcmediatr

Visual Studio cannot find SingleInstanceFactory


I've missed something, but not sure.

I have included using MediatR;

and I am trying to register types using Unity:

//--------- External Dependencies --------\\
container.RegisterType<IMediator, Mediator>();


container.RegisterInstance<SingleInstanceFactory>(t => container.Resolve(t));
container.RegisterInstance<MultiInstanceFactory>(t => container.ResolveAll(t));

But VS is telling me it can't find SingleInstanceFactory or MultiInstanceFactory. The project is targeting .NET 4.5.1 and I am using the latest Unity, MediatR.

Latest MediatR, https://github.com/jbogard/MediatR/blob/master/src/MediatR/Mediator.cs

I was just copying from the examples give by Jimmy.


Solution

  • The latest mediatR pull from nuget - https://www.nuget.org/packages/MediatR is 1.0.0

    The factory method delgates you were referring to were not added until later - this changeset - https://github.com/jbogard/MediatR/commit/82ce595fcd5d265862bf80127fee932902c3d8cd

    You should get the latest source from main and build yourself.