problem about ninject-2-Collection of common programming errors


  • Ruben Bartelink
    .net ioc-container ninject ninject-2 constructorargument
    When using Ninjects ConstructorArgument you can specify the exact value to inject to specific parameters. Why can’t this value be null, or how can I make it work? Maybe it’s not something you’d like to do, but I want to use it in my unit tests.. Example: public class Ninja {private readonly IWeapon _weapon;public Ninja(IWeapon weapon){_weapon = weapon;} }public void SomeFunction() {var kernel = new StandardKernel();var ninja = kernel.Get<Ninja>(new ConstructorArgument(“weapon”, null)); }

  • Paul D’Ambra
    asp.net-mvc-2 c#-4.0 ninject-2 ninject-extensions
    I foolishly decided to try something new on a Friday job!So I have used NuGet to add Ninject.Web.Mvc 2.2.x.x to my .Net MVC2 project.I’ve altered my Global.asax.cs using System.Web.Mvc; using System.Web.Routing; using IntegraRecipients; using Mailer; using Ninject; using Ninject.Web.Mvc; using Ninject.Modules;namespace WebMailer {public class MvcApplication : NinjectHttpApplication {public static void RegisterRoutes(RouteCollection routes){routes.IgnoreRoute(“{resource}.axd/{*pathInfo}”);routes.

  • Ahmad
    ninject ninject-2
    How do I inject and create an object at runtime based on some processing? In the code below, the main calculator (GridCalculator) (snipped for brevity) has a dependency on a PricesCalculator. However, some processing need to happen in the main calculator first prior to the instantiation of a PricesCalculator. The GridPortfolios property of the PricesCalculator will always and can only be know at runtime. I am not sure how to set the value of this property at runtime (I am not concerned about the

  • chobo2
    .net nhibernate repository-pattern unit-of-work ninject-2
    I am using nhibernate + fluent nhibernate asp.net mvc 3 ninjectCurrently I am using nhibernate, ninject with the repository pattern and service layers.So I have thisninjectpublic class NhibernateSessionFactory{public ISessionFactory GetSessionFactory(){ISessionFactory fluentConfiguration = Fluently.Configure().Database(MsSqlConfiguration.MsSql2008.ConnectionString(c => c.FromConnectionStringWithKey(“ConnectionString”))).Mappings(m => m.FluentMappings.AddFromAssemblyOf<Framework.Data.Map

  • Max
    nhibernate asp.net-mvc-2 .net-3.5 ninject-2
    I am getting an error in my MVC Application when trying to create a connection. I’m using NHibenate along with Ninject.Global.asax.cs file:namespace Web.UI {public class MvcApplication : NinjectHttpApplication // System.Web.HttpApplication{public static ISessionFactory SessionFactory { get; set; }public void CreateSessionFactory(){SessionFactory = (new Configuration()).Configure().BuildSessionFactory();}public static void RegisterRoutes(RouteCollection routes){routes.IgnoreRoute(“{resource}.axd/

  • Nozi
    asp.net-mvc-3 membership-provider ninject-2 roleprovider
    Hi i got some problems enabling custom Membership and Role Provider, i got following error:***Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.InvalidOperationException: Default Membership Provider could not be found.It’s pointing to my mvc3.ninject kernel.Inject(Membership.Provider)My MVC3.Ninject in app_start:private stat

Web site is in building