ninject.web

Using ninject with Ninject.Web.Api for Web Api 2 is not working in ASP.NET MVC 5

℡╲_俬逩灬. 提交于 2021-02-18 07:06:20
问题 I am developing an Asp.NET MVC project. My project has web api as well. I am using ASP.NET MVC5 and Web Api 2 with Visual Studio 3. I am doing dependency injection using ninject. I know ninject for web is not working for Web Api 2. So I tried to use Ninject for Web Api. I installed ninject for web api 2 package using nuget package manager Then I installed Ninject.Web using nuget package manager Then in NinjectWebCommon, I added this line in RegisterServices private static void

Ninject throws Activation Exception in a WebApi project with multiple assemblies

大城市里の小女人 提交于 2020-01-14 10:23:08
问题 My asp.net WebApi project comprises of multiple assemblies for Services, Core and Data Access. In an attempt to use Ninject as my DI container in the project, I added Ninject.Web.Common package from NuGet. Then, I Implemented IDependencyResolver as: public class NinjectDependencyResolver : NinjectDependencyScope, IDependencyResolver { readonly IKernel kernel; public NinjectDependencyResolver(IKernel kernel) : base(kernel) { this.kernel = kernel; } public IDependencyScope BeginScope() { return

Ninject throws Activation Exception in a WebApi project with multiple assemblies

百般思念 提交于 2020-01-14 10:23:07
问题 My asp.net WebApi project comprises of multiple assemblies for Services, Core and Data Access. In an attempt to use Ninject as my DI container in the project, I added Ninject.Web.Common package from NuGet. Then, I Implemented IDependencyResolver as: public class NinjectDependencyResolver : NinjectDependencyScope, IDependencyResolver { readonly IKernel kernel; public NinjectDependencyResolver(IKernel kernel) : base(kernel) { this.kernel = kernel; } public IDependencyScope BeginScope() { return

Ninject throws Activation Exception in a WebApi project with multiple assemblies

可紊 提交于 2020-01-14 10:23:05
问题 My asp.net WebApi project comprises of multiple assemblies for Services, Core and Data Access. In an attempt to use Ninject as my DI container in the project, I added Ninject.Web.Common package from NuGet. Then, I Implemented IDependencyResolver as: public class NinjectDependencyResolver : NinjectDependencyScope, IDependencyResolver { readonly IKernel kernel; public NinjectDependencyResolver(IKernel kernel) : base(kernel) { this.kernel = kernel; } public IDependencyScope BeginScope() { return

Dependency Injection with Ninject and Global Filter: IAuthorizationFilter

杀马特。学长 韩版系。学妹 提交于 2019-12-24 14:58:19
问题 I use standart NinjectMVC3 Bootstrapper installed in the App_Start folder. My application class looks like: public class MvcApplication : HttpApplication { static void RegisterRoutes(RouteCollection routes) { // ... routes here ... } public void Application_Start() { AreaRegistration.RegisterAllAreas(); RegisterGlobalFilters(GlobalFilters.Filters); RegisterRoutes(RouteTable.Routes); } static void RegisterGlobalFilters(GlobalFilterCollection filters) { // empty } } I have only following

Cannot upgrade Ninject to latest version in Nuget

ε祈祈猫儿з 提交于 2019-12-23 13:03:56
问题 I have a ASP.NET WebForms application that uses some Ninject packages, but I am stuck at a certain version. When I try to upgrade to the latest version, I get "Unable to resolve dependencies" issues. The packages in question are: Package InstalledVer LatestVer ------------------------------------------------------ Ninject v3.2.2 v3.3.4 Ninject.Web v3.2.1 ✔ v3.2.1 Ninject.Web.Common v3.2.3 v3.3.1 Ninject.Web.Common.WebHost v3.2.3 v3.3.1 If I try updating Ninject , I get: Unable to resolve

ASP.NET MVC 2, Ninject 2.2 and no parameterless constructor defined for this object

风格不统一 提交于 2019-12-23 10:29:32
问题 So I've been spending some time with ASP.NET MVC 2 (currently stuck with using Visual Studio 2008) and have now moved onto using Ninject 2.2 and its MVC integration. I've downloaded Ninject 2.2 and Ninject.Web.Mvc from the following locations: https://github.com/downloads/ninject/ninject/Ninject-2.2.0.0-release-net-3.5.zip https://github.com/downloads/ninject/ninject.web.mvc/Ninject.Web.Mvc2-2.2.0.0-release-net-3.5.zip And referenced them in my MVC 2 project. My Global.asax.cs file looks like

ASP.NET MVC 2, Ninject 2.2 and no parameterless constructor defined for this object

吃可爱长大的小学妹 提交于 2019-12-23 10:28:46
问题 So I've been spending some time with ASP.NET MVC 2 (currently stuck with using Visual Studio 2008) and have now moved onto using Ninject 2.2 and its MVC integration. I've downloaded Ninject 2.2 and Ninject.Web.Mvc from the following locations: https://github.com/downloads/ninject/ninject/Ninject-2.2.0.0-release-net-3.5.zip https://github.com/downloads/ninject/ninject.web.mvc/Ninject.Web.Mvc2-2.2.0.0-release-net-3.5.zip And referenced them in my MVC 2 project. My Global.asax.cs file looks like

Ninject.Web (webforms extension), injecting outside of a webform page?

梦想的初衷 提交于 2019-12-11 07:33:15
问题 I've been using the Ninject.Web extension to inject business objects, repositories, Entity Framework context etc into my application. This works very well using the [Inject] attribute which can be applied within a webform that inherits from PageBase. I am now running into a snag as I am trying to write a custom membership provider that needs injection done inside of it but of course this provider is not instantiated from within a webform. Forms Authentication will instantiate the object when

ASP.NET MVC 3 and Global Filter Injection

二次信任 提交于 2019-12-04 13:43:42
问题 Hello am an trying to implement a global filter with injection. The filter looks like this. public class WikiFilter : IActionFilter { private IWikiService service; public WikiFilter(IWikiService service) { this.service = service; } public void OnActionExecuting(ActionExecutingContext filterContext) { !!!Code here!! } public void OnActionExecuted(ActionExecutedContext filterContext) { throw new NotImplementedException(); } } And i have attached the filter with injection the following way in my