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

Service is always null using lightinject

I'm trying to register some services on a base controller that will available per request. public interface IInstagramApiService { } public interface IApiServiceConfiguration { string CacheKeyPrefix { get; } } Then I have some concrete…
madebybear
  • 359
  • 4
  • 8
0
votes
1 answer

Use IOC Container In ASP.NET Web Api 2

i use LightInject(Light weight IOC Container in C#) in ExirRobot.Infrastructure as a global IOC Container Project in my solutionExplorer(Picture Was Attached).I want to register Ioc Config Class(IOC.cs) in ExirRobot.WebApi project inorder to inject…
0
votes
1 answer

LightInject typed factories with parameters

Per documentation of LightInject we can create a typed factory and pass a value to it like this: public class Foo : IFoo { public Foo(int value) { Value = value; } public int Value { get; private set; } } public interface…
Ben
  • 538
  • 1
  • 9
  • 24
0
votes
0 answers

How to retrieve instance based on current thread culture

The setup: LightinjectComposition.cs serviceRegistry.Register(f => IdentityLocator.GetInstance()); serviceRegistry.Register(f => f.GetInstance().Get()); // I could use this too: //…
Skaparate
  • 489
  • 3
  • 14
0
votes
1 answer

Implementation of the NServiceBus/MassTransit IContainer with DryIoc or LightInject

I had used DryIoc and LightInject in most of my .Net Web API 2+ solutions. Using new architecture, I would prefer to use NServiceBus or MassTransit for my next ESB implementation. However, I could not find any useful code reference that could help…
0
votes
1 answer

How can I inject class-specific logger using LightInject?

Many logging frameworks provide class-specific loggers: NLog: Logger.GetLogger(typeof(MyClass).Name) Serilog: Log.Logger.ForContext() To be able to inject these class specific loggers, one would do something like this in Ninject: …
Geir Sagberg
  • 9,632
  • 8
  • 45
  • 60
0
votes
2 answers

LightInject - No scope when calling WebApi OWIN Identity TokenEndpointPath

I have a very basic WebAPI setup with token authentication. In the application start I do: protected void Application_Start() { DependencyConfig.RegisterDependecis(); //... //... } Which calls: public class DependencyConfig { …
0
votes
1 answer

What's the equivalent of CastleWindsor's container.Release in LightInject?

I saw ASP.NET Web API dependency injection in Seemann's site. It uses CastleWindsor though. request.RegisterForDispose( new Release( () => this.container.Release(controller))); What's the equivalent of CastleWindsor's…
Hao
  • 8,047
  • 18
  • 63
  • 92
0
votes
1 answer

LightInject IoC container throws stackoverflow in fallback method

I am fiddling with LightInject to try and set up a IoC solution containing a Domain proj, a Infrastructure proj, a MVC proj, and a DependencyResolution proj. Infrastructure, MVC, and DependencyResolution references Domain. MVC references…
SvanSr
  • 1
  • 2
0
votes
1 answer

Web API, Light Inject and Passing a Static Dictionary to the data layer

We have a multi-database solution and are passing the connection string to a factory function like so: container.Register( f => new DynamicDbContextFactory(ClientConfig.GetConnectionString()), new…
lucuma
  • 18,247
  • 4
  • 66
  • 91
0
votes
2 answers

StackOverflow exception when using Fallback with Create in LightInject 3.0.2.5

This is a copy of https://github.com/seesharper/LightInject/issues/173 I tried to automatically create concrete types using fallback and .Create() but it somehow loops itself and I don't understand why. Here is my test code: public class Foo { …
0
votes
1 answer

LightInject Determine type being resolved?

I am looking at moving from Ninject to a lighter weight (and faster) Ioc framework. I picked up LightInject and am having a play, but can't find how to do the following: From within a call to RegisterConstructorDependency I want to be able to…
Ash
  • 5,057
  • 7
  • 35
  • 49
0
votes
1 answer

How to bind Interfaces to Methods using LightInject

In Ninject when I wanted to bind NHibernate's ISession to a method I'd do : container.Bind().ToMethod(CreateSession).InRequestScope(); While the method is : private ISession CreateSession(IContext context) { var sessionFactory =…
user3550283
  • 159
  • 6
0
votes
2 answers

Implement LightInject WCF into a WCF web Service

I am trying to implement LightInject into my WCF service. I have the LightInject.Wcf class file from GitHub but i have no clue on how to use it in my service. Please help
0
votes
1 answer

LightInject for windows phone 8.1

has anyone been able to add LightInject to windows phone 8.1 project. I get an error Could not install package 'LightInject 3.0.2.0'. You are trying to install this package into a project that targets 'WindowsPhoneApp,Version=v8.1', but the package…
partyelite
  • 822
  • 1
  • 15
  • 26