ninject Questions

4

Solved

How can I configure Ninject to resolve null with my constructor injection? I am using ToMethod with a factory method and InTransientScope. My factory is designed to return null if certain things ar...
Alto asked 2/3, 2011 at 1:15

3

Weird stuff going on: In my web api, I inject a repository into the controller upon resolving using Ninject. The repository gets stored in a private readonly member variable. Works perfectly fine! ...
Gainsay asked 6/1, 2015 at 16:14

6

I have a problem with Ninject which I have not seen before and don't know how to fix. I am using the MVC NuGet package for MVC 5. In my NinjectWebCommon.cs, there is the following method: public...
Cartagena asked 16/7, 2014 at 9:13

3

I am working on an ASP.NET MVC application. I have initialized my LoggerFactory in a static class which is called from Global.asax using Microsoft.Extensions.Logging; using Serilog; using System....

9

Solved

How do I combine constructor injection with "manual" constructor parameters? ie. public class SomeObject { public SomeObject(IService service, float someValue) { } } Where IService should be ...
Leroylerwick asked 4/8, 2011 at 3:29

5

Solved

I'm starting a web application with MVC3 and Ninject. There is one dependency that I also need in the Global.asax file that needs to be a singleton. I thought it should be like this: public class...
Aquavit asked 1/4, 2011 at 10:21

2

Solved

I'm currently trying out Autofac in a new ASP.NET MVC project after having used Ninject, Castle Windsor and other IoC containers in the last years. So while I know about IoC containers in general, ...
Buck asked 24/2, 2012 at 16:5

3

I'm migrating an MVC/WebApi application to using Owin, but after installing all the components, and moving all configuration from the globals.asax to Startup.cs i'm getting the error Type 'EventCon...
Hylton asked 20/6, 2015 at 20:6

2

I am migrating a large codebase from Ninject to Autofac and am struggling on one of the bindings that I believe is causing an activation error based on some of my debugging. Ninject: Bind<ISecur...
Transfinite asked 28/3, 2018 at 13:56

4

Solved

I have an interface with a few different concrete implementations. I am trying to give Ninject a default to use and only use the other implementation if a name matches. For instance, I have the fol...
Gipon asked 13/5, 2011 at 20:36

3

Solved

I'm trying to figure out correct way how to bind something like this with ninject. interface IMainService { void DoStuff(); } interface IOtherService { void DoSomeMagic(); } abstract class Bas...
Anglim asked 18/8, 2010 at 11:29

3

Solved

I am currently using the following code: public class MyProvider { public MyProvider() { } public void Fetch() { using (PopClient popClient = new PopClient()) { .... } } } Because I w...
Fagaly asked 10/9, 2012 at 22:23

2

Solved

I am learning about the Onion Architecture. I have a confusion about the service layer, because I see some people saying that the core layer should only contain: Models Repository interfaces Serv...
Resolution asked 31/5, 2013 at 15:44

2

Solved

I have an ASP.NET MVC3 website setup using fluent validation and ninject. The validation code is working. However, I set a break point in the validation class constructor and I noticed that when I ...
Thermoelectrometer asked 18/10, 2011 at 15:53

4

I've just started learning Ninject but have come across a problem with the logger. I've currently got a controller that has a service and logger injected into the constructor like so: public Tools...
Scaler asked 6/12, 2012 at 16:47

4

I have been helping a few friends on a project and there is a class that uses Ninject. I am fairly new to C# and I have no idea what that class is doing, which is why I need to understand Ninject. ...
Uroscopy asked 28/6, 2013 at 23:49

9

Solved

I'm developing a MVC5 project on Visual Studio 2017 Version 15.4. I'm getting unexpected result here what I never faced before. I've installed Ninject.MVC5 package from nuget. It's installing nicel...
Poisson asked 17/11, 2017 at 10:19

4

I am getting this error when I try to use code first migrations. My context has a constructor with the connection name. public class VeraContext : DbContext, IDbContext { public VeraContext(stri...

3

Solved

I currently use NInject to bind interfaces to concrete types and inject those into my classes. However, it is my understanding that this is a run-time affair. To me, it seems like a point of attack...
Andrey asked 22/3, 2013 at 10:58

5

Long story short, I'm trying to use ELMAH with MVC 2 and Ninject, and I need to use parameterless constructors. I created an initial post about it here: Using a parameterless controller constructor...
Ricoriki asked 2/2, 2011 at 2:0

10

Solved

I have the following packages and their dependencies installed in my WebAPI project: Ninject.Web.WebApi Ninject.Web.WebApi.OwinHost I am running this purely as a web-api project. No MVC. When I ...

8

Solved

I have created a new MVC5 project with Web API 2, I then added the Ninject.MVC3 package from NuGet. Constructor injection is working fine for the MVC5 controllers, but i am getting an error when...
Millda asked 15/12, 2013 at 14:13

2

Solved

I am tring to use Ninject as a IoC container but could not understand how to create an instance of a class that has more than 1 parameter in the constructor. Basically I have a service interface fo...
Razee asked 4/9, 2014 at 14:17

10

I'm developing an ASP.NET Web Api 2.2 with C#, .NET Framework 4.5.1. After updating my Web.Api to Ninject 3.2.0 I get this error: Error activating ModelValidatorProvider using binding from ModelV...
Dolichocephalic asked 11/10, 2014 at 7:29

0

I have an ASP.NET Web Application (.NET Framework 4.8) in which I've set up NInject but any services I set up with InRequestScope are coming through as if transient scope (i.e. new instances are cr...
Vinificator asked 17/6, 2020 at 0:43

© 2022 - 2024 — McMap. All rights reserved.