ninject-extensions

Ninject WCF Extension ArgumentNullException using NET.TCP Binding

允我心安 提交于 2020-02-02 00:30:48
问题 I have a WCF 4 service with 2 endpoints configured to use wsHttpBinding and netTcpBinding. I am hosting the service within IIS 7.5 using WAS and am using the Ninject WCF extension to DI into my service. My service works fine when I use the wsHttpBinding endpoint to call my service but fails when I use the netTcpBinding. When I look in my Application Event Log I get the following error outlined below. I have tried debugging the problem in VS2010 but am getting nowhere fast with this. I don’t

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

Ninject Factory on Derived Types

浪子不回头ぞ 提交于 2020-01-01 17:28:10
问题 I'm looking at the Ninject Factory extension at the following link: http://www.planetgeek.ch/2011/12/31/ninject-extensions-factory-introduction/ I'm trying to wrap my head around the extension and see if it actually fits into what I'm trying to do. Can the factory extension create different types based on a parameter that is passed in? Example: class Base {} class Foo : Base {} class Bar : Base {} interface IBaseFactory { Base Create(string type); } kernel.Bind<IBaseFactory>().ToFactory();

Cannot get Ninject.Extensions.Conventions to work

时间秒杀一切 提交于 2019-12-31 02:01:09
问题 I've been trying to get Ninject.Extensions.Conventions for (Ninject 3+) working, with no luck. I boiled it down to a found sample console app, and I can't even get that going. Here's what I have: class Program { static void Main(string[] args) { var kernel = new StandardKernel(); kernel.Bind(x => x .FromThisAssembly() .SelectAllClasses() .BindAllInterfaces()); var output = kernel.Get<IConsoleOutput>(); output.HelloWorld(); var service = kernel.Get<Service>(); service.OutputToConsole();

Ninject Interception 3.0 Interface proxy by method attributes

a 夏天 提交于 2019-12-25 06:26:29
问题 I have just upgraded a relatively large codebase from Ninject 2.2 to Ninject 3.0. Everything seems to be going as planned except I had to make a few changes to the interception stuff that we use. interface IFoo { Bar GetBar(); } class Foo : IFoo { [LogMethod(Level = LogLevel.Error)] public virtual Bar GetBar() { return new Bar(); } } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Method, AllowMultiple = false, Inherited = true)] class LogMethodAttribute

Ninject: One interceptor instance per one class instance being intercepted?

陌路散爱 提交于 2019-12-24 00:16:57
问题 I'm currently having a problem, trying to wire up exactly one interceptor instance per one instance of class being intercepted. I'm creating and Advice in the InterceptorRegistrationStrategy and setting the callback to resolve an interceptor from the kernel (it has an injection constructor). Please note that I can only instantiate interceptor in the callback because InterceptorRegistrationStrategy does not have reference to Kernel itself. IAdvice advice = this.AdviceFactory.Create(methodInfo)

NamedScope and garbage collection

[亡魂溺海] 提交于 2019-12-23 09:00:48
问题 (This question was first asked in the Ninject Google Group, but I see now that Stackoverflow seems to be more active.) I'm using the NamedScopeExtension to inject the same ViewModel into both the View and the Presenter. After the View have been released, memory profiling shows that the ViewModel is still retained by the Ninject cache. How can I make Ninject release the ViewModel? All ViewModels are released when the Form is Closed and Disposed, but I'm creating and deleting Controls using a

How to bind using Ninject Conventions Extension?

≡放荡痞女 提交于 2019-12-22 12:24:08
问题 I like to bind bellow code with Ninject auto binding. Is it possible to use both mannual & auto binding within a single project? Let;s take bellow manual binding, I want to achieve with auto binding. Please tell me how to achieve this. kernel.Bind<TestContext>().ToSelf().InRequestScope(); kernel.Bind<IUnitOfWork<TestContext>>().To<UnitOfWork<TestContext>>(); Bellow all interface inherited from base Interface : IRepository< Model > 3 . kernel.Bind<IUserRepository>().To<UserRepository>(); 4 .