FAQ Database Discussion Community


inject - InSessionScope Extension problems with AppFabric Cache

c#,asp.net-mvc,ninject,ninject.web.mvc,ninject-extensions
Ninject doesn’t provide a InSessionScope Binding for Websites, so we have created our own extension: public static IBindingNamedWithOrOnSyntax<T> InSessionScope<T>(this IBindingInSyntax<T> parent) { return parent.InScope(SessionScopeCallback); } private const string _sessionKey = "Ninject Session Scope Sync Root"; private static object SessionScopeCallback(IContext context) { if (HttpContext.Current.Session[_sessionKey] == null) { HttpContext.Current.Session[_sessionKey] = new object();...

Ninject.Mvc5 does not work with mono

asp.net,asp.net-mvc,mono,ninject,ninject.web.mvc
Am following video tutorial from you-tube for making web app with ASP.Net. The guy teaching there is using Windows and Visual Studio. I'm on Ubuntu 14.04 and Monodevelop. Everything is set and running but Ninject (3.2.0.0) does not work. After installing from NuGet, it created file NinjectWebCommon.cs have class NinjectWebCommon....

Ninject ASP.NET Identity The type '…' cannot be used as type parameter 'TImplementation' in the generic type or method

c#,dependency-injection,asp.net-identity-2,ninject.web.mvc
I'm getting a few compiler errors about my bindings with Ninject. This is the code: kernel.Bind<IUserStore<ApplicationUserStore>>().To<UserStore<ApplicationUser, ApplicationRole, int, ApplicationUserLogin, ApplicationUserRole, ApplicationUserClaim>>().InRequestScope(); kernel.Bind<IRoleStore<ApplicationRoleStore>>().To<RoleStore<ApplicationRole, int, ApplicationUserRole>>().InRequestScope(); And these are the compiler errors: Error 5 The type 'MyNamespace.Data.ApplicatonRoleStore'...

Can I use Ninject when setting up my routes?

asp.net-mvc,asp.net-mvc-routing,ninject,ninject.web.mvc
I have an ASP.NET MVC5 web site that uses Ninject. The site is for an online magazine. What I would like to do is set up some routes, but pull the data from an injected repository. So, I would like to have routes like these... routes.MapRoute("Section9", "Section9_Ask-the-professional", new {controller =...

Ninject Decorator not being used

ninject,ninject-2,ninject.web.mvc
What I am trying to do is wrap a decorator around a command using the following code. public interface ICommand { } public interface ICommand<T> : ICommand where T : class { void Execute(T args); } public class TransactionalCommand<T> : ICommand<T> where T : class { private readonly ICommand<T> command;...

How to load the correct controller based on host name

asp.net-mvc-5,ninject.web.mvc
I am looking for some advice on how to achieve the following. I have an MVC5 .NET web application. In this application I have created a base controller, this controller is the parent for many child controllers. Each child controller has its own set of views, which have their own...