简体   繁体   中英

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM