GithubHelp home page GithubHelp logo

mvvmcross.adapter.ninject's People

Contributors

thefex avatar

Watchers

 avatar  avatar

mvvmcross.adapter.ninject's Issues

Multiple bindings matched from PLC module

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.