2

I have separate Ninject modules for each of my application layers, defined in their own projects. I am trying to reuse the same modules in console applications, services and my web application. However, for a handful of the bindings I scope them differently depending on the type of the app: InSingletonScope, InRequestScope, etc. Right now, these bindings are ending up in my top-level modules because of the differences in scope. For instance, in my web application, the scope of the DbContext is set to InRequestScope. It is set to InSingletonScope in my console applications.

Eventually, I would like to break the direct dependency between my top-level project and the projects where the implementations reside. It would be nice to say, "find the binding for T and apply this scope to it." It doesn't look like this is supported. I was wondering if there was a way to update a binding's scope after-the-fact or decorate a Ninject module with a scope to use.

Travis Parks
  • 8,435
  • 12
  • 52
  • 85
  • 1
    Possible duplicate of [How to change the scope of an existing binding in Ninject](http://stackoverflow.com/questions/24613102/how-to-change-the-scope-of-an-existing-binding-in-ninject) – BatteryBackupUnit Nov 19 '15 at 12:50

0 Answers0