thefex / mvvmcross.adapter.ninject Goto Github PK
View Code? Open in Web Editor NEWThis is a Ninject IoC provider for MvvmCross.
License: MIT License
This is a Ninject IoC provider for MvvmCross.
License: MIT License
H,
I'm developing Xamarin project with MvvmCross with Ninject Adapter. I implemented the NinjectDependenciesProvider
as suggested in Wiki:
public class NinjectIosDependenciesProvider : NinjectDependenciesProvider
{
protected override IEnumerable<INinjectModule> GetPlatformSpecificModules()
{
return new[]
{
new IosNinjectModule()
};
}
protected override IEnumerable<INinjectModule> GetPortableNinjectModules()
{
return new[]
{
new CommonDependenciesModule()
};
}
}
CommonDependenciesModule
is placed in PCL and IosNinjectModule
in my iOS project. They are standard Ninject modules:
internal class IosNinjectModule : NinjectModule
{
public override void Load()
{
Bind<IActiveDirectoryAuthenticationService>().To<ActiveDirectoryAuthenticationService>();
Bind<IBlobCache>().ToMethod(ctx => BlobCache.LocalMachine);
Bind<ISecureBlobCache>().ToMethod(ctx => BlobCache.Secure);
Bind<IAnalyticsTrackingService>().To<AnalyticsTrackingService>();
}
}
public class CommonDependenciesModule : NinjectModule
{
public override void Load()
{
Bind<IRoomReservationService>().To<MockedRoomsListReservationService>();
}
}
As you can see no bindings are overlapping.
When MvvmCross is trying to resolve the IRoomReservationService
type to create a view model I receive the following error:
Error activating IRoomReservationService
More than one matching bindings are available.
Matching bindings:
1) binding from IRoomReservationService to MockedRoomsListReservationService
2) binding from IRoomReservationService to method
3) binding from IRoomReservationService to method
Activation path:
2) Injection of dependency IRoomReservationService into parameter roomReservationService of constructor of type RoomsListViewModel
1) Request for RoomsListViewModel
Suggestions:
1) Ensure that you have defined a binding for IRoomReservationService only once.
Two matching bindings to methods are complete mystery for me. Any clue what might be the cause?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.