Looking Ninject eqequivalent uivalent to structuremap code snippet

6 views
Skip to first unread message

spaceradar...@gmail.com

unread,
Dec 15, 2017, 5:16:02 AM12/15/17
to ninject
Can someone tell the equivalent to the snippet of code shown below in Ninject?

The code below is used with structuremap. It compiles ok
         For<IUserStore<SpaceRadarIdentityUser>>()
                .Use<SpaceRadar.Business.Layer.Repository.SpaceRadarUserStore>()
                .Ctor<ISpaceRadarDbContext>();



I tried using this snippet using Ninject but I got the errors listed following the code snippet
 container.Bind < IUserStore<SpaceRadarIdentityUser>().To<SpaceRadarUserStore>()
               .WithConstructorArgument(ISpaceRadarDbContext);


Error    CS0201    Only assignment, call, increment, decrement, and new object expressions can be used as a statement    SpaceRadar.Web.Api    C:\spaceradarweb\spaceradarweb\SpaceRadar\SpaceRadar\src\SpaceRadar.Web.Api\App_Start\NinjectConfigurator.cs    166    Active


Error    CS1955    Non-invocable member 'IUserStore<TUser>' cannot be used like a method.    SpaceRadar.Web.Api    C:\spaceradarweb\spaceradarweb\SpaceRadar\SpaceRadar\src\SpaceRadar.Web.Api\App_Start\NinjectConfigurator.cs    166    Active


Error    CS0119    'ISpaceRadarDbContext' is a type, which is not valid in the given context    SpaceRadar.Web.Api    C:\spaceradarweb\spaceradarweb\SpaceRadar\SpaceRadar\src\SpaceRadar.Web.Api\App_Start\NinjectConfigurator.cs    167    Active

Reply all
Reply to author
Forward
0 new messages