light-inject

Converting lightInject to .netcore DI

我怕爱的太早我们不能终老 提交于 2019-12-13 09:45:55
问题 I am converting some lightInject code to .netcore DI In .netcore DI, we have AddSingleton and AddTransient functions for registering the service. In the lightInject, I have RegisterMethod. So I just want to know whether the Register methods registers only singleton instance or multiple when ever we call. 回答1: based on documentation The default behavior in LightInject is to treat all objects as transients unless otherwise specified. So in .Net Core, you would need to register your services as

Getting Started with LightInject

和自甴很熟 提交于 2019-12-11 02:57:22
问题 I love the benchmarks on LightInject; they are insane! Way to go, you should write a book on .Net performance, I'm serious. I see the documentation. I got the dll installed. Followed that step ok. Then the next step of the documentation presumes I have a container object. container.Register<IFoo, Foo>(); var instance = container.GetInstance<IFoo>(); Assert.IsInstanceOfType(instance, typeof(Foo)); Whoops! I may not be the sharpest crayola in the box, granted, but what do I do now? What class

LightInject IoC container throws stackoverflow when resolving type

北城以北 提交于 2019-12-10 13:45:36
问题 When trying out the LightInject IoC container http://www.lightinject.net/ it throws a stackoverflow exception when resolving the type ISomeService: All types are registered in App_Start: container.RegisterAssembly("MyApp*.dll"); And then when I try to resolve it in the controller it fails and throws a stackoverflow exception: public SomeController(ISomeService someService) { _someService = someService; } It also has the same error when using ServiceLocator: ServiceLocator.Current.GetInstance

SignalR server --> client call not working

半世苍凉 提交于 2019-12-10 13:26:31
问题 I'm currently using SignalR to communicate between a server and multiple separate processes spawned by the server itself. Both Server & Client are coded in C#. I'm using SignalR 2.2.0.0 On the server side, I use OWIN to run the server. I am also using LightInject as an IoC container. Here is my code: public class AgentManagementStartup { public void ConfigurationOwin(IAppBuilder app, IAgentManagerDataStore dataStore) { var serializer = new JsonSerializer { PreserveReferencesHandling =