Questions tagged [light-inject]

An ultra lightweight single file Inversion of Control container for the .Net framework.

An ultra lightweight single file Inversion of Control container for the .Net framework. Use attributes to control injected dependencies. LightInject has full support for the new Windows Runtime making it a perfect choice for Windows Store Apps. Implement cross cutting concerns using the AOP capabilities of LightInject.

LightInject provides two distribution models via NuGet

96 questions
0
votes
1 answer

Dependency injection(Autofac equivalent for resolvebyname or key)

It was very handy with Autofac on dependency injection. Recently I changed project where lightinject and unitycontainer uses. Here I am able to register a list of services with a name, but I'm unable to resolve by a name. I tried to get it as…
0
votes
1 answer

Get Hangfire working with ASP.NET MVC and LightInject

I have an ASP.NET MVC App and I recently upgraded to use LightInject DI. However I cant seem to get Hangfire running correctly, even using the LightInject Extension! My Hangfire setup in Startup.cs: public void Configuration(IAppBuilder…
dalcam
  • 1,027
  • 11
  • 28
0
votes
0 answers

InvalidOperationException: Attempt to create a disposable instance without a current scope - LightInject with .NET Core 3.0

I have been setting up DI using LightInject for a new .NET Core 3.0 project. I followed the guide here: https://www.lightinject.net/microsoft.aspnetcore.hosting/. While running the project, I have encountered this…
0
votes
0 answers

Casting Exception in LoadApplication when using LightInject

I'm new to Xamarin Forms and LightInject. I'm getting an exeption : System.InvalidCastException: Specified cast is not valid. when calls LoadApplication(new App()); in MainActivity.cs when calling the instance as a NavigationPage this happens. I…
0
votes
1 answer

Unresolved DI in aspnet core with lightinject

Apologies for the long text! I'm trying to build a message listener for RabbitMQ in aspnet core 2.1. As soon as I post a message, I get this error in the log: 2018-09-29 12:35:35.459 INFO NServiceBus.RecoverabilityExecutor Immediate Retry is going…
Arun
  • 1,015
  • 1
  • 11
  • 26
0
votes
1 answer

Intercept action controller with arguments in mvc 5 with lightinject interception

I'm not able to intercept a controller action with arguments. I'm using Asp.Net MVC 5 with LightInject and LightInject.Interception. I receive the following error: Unable to cast object of type 'System.Object[]' to type…
Zu1779
  • 2,178
  • 1
  • 18
  • 17
0
votes
1 answer

Using LightInject, how can I register a generic service with a factory method?

I want to configure a logger that logs to xUnit test output, and should be substituted for all ILogger dependencies. As far as I can tell, the way to solve this is to use a generic service with a factory method. When using…
Geir Sagberg
  • 9,632
  • 8
  • 45
  • 60
0
votes
1 answer

Accessing Container instance with LighInject

When using LightInject, how can you use access the Container instance in contexts other than initial registration/bootstrapping? I followed LightInject's getting started guide and google around, but didn't find anything like that. For reference, I…
daniloquio
  • 3,822
  • 2
  • 36
  • 56
0
votes
1 answer

Creating a LightInject Bootstrapper for Prism, missing registration of region adapters

I'm trying to create a LightInject bootstrapper for Prism, I've copied the code of the NinjectBootstrapper (source) and replaced Ninject's IKernel with LightInject's IServiceContainer. I've also created and registered a…
Roy T.
  • 9,429
  • 2
  • 48
  • 70
0
votes
1 answer

LightInject - Interception not intercepting dependencies

I'm using LightInject with the ServiceProvider adapter on an MVC website. I'm trying to wire it into MiniProfiler, but I'm not having much luck. MiniProfiler seems to be capturing the MVC Controller Lifecycle, but not any of the dependencies: Mini…
0
votes
1 answer

ObjectFactory.GetInstance analog in LightInject IoC container

Is there any analog of "ObjectFactory.GetInstance" in LightInject IoC container? For example, I need to resolve interface in my custom behaivour attribute which is inherited from IServiceBehavior, but by default interface I need is not…
VoimiX
  • 1,180
  • 3
  • 16
  • 31
0
votes
1 answer

LightInject multiple constructors

Been using LightInject for a while now and it has been great! Hit a snag trying to support multiple constructors of the same type, though. See the simplified example below. Foo has four constructors, differing by the type and number of arguments.…
user1118189
0
votes
1 answer

ASP.NET MVC 5 and LightInject

I am trying to use LightInject with my current project but I keep getting a null value. I have a web app in MVC 5 and a business tier attached with it. I have installed the LightInject.Mvc and LightInject.Web in my web project. I have installed…
Skadoosh
  • 2,575
  • 8
  • 40
  • 53
0
votes
1 answer

Resolve dependency through xml file or web.config using lightinject

When using lightinject, is there any way to use a string value from an external config file to tell the container to register the service as mentioned in the file? This would be in an xml file or a web.config file. For example, within a previous…
0
votes
1 answer

Method Not Found when using LightInject with MVC5 and .Net 4.5

When setting up LightInject for an MVC controller I am getting an error when calling container.EnableMvc(); in the injector setup. Error: Method not found: 'Void…
QueueHammer
  • 10,515
  • 12
  • 67
  • 91