/FlexDi

A small dependency injection/IoC container for .NET, based on BoDi

Primary LanguageC#Apache License 2.0Apache-2.0

As of September 2023 this repository is archived; no further development will happen here and I am retiring FlexDi. Prompted by issue #20 & issue #18, I have moved future development to CSF.Extensions.DependencyInjection.

That project is based on extending Microsoft's standard/minimal DI container instead of writing a whole new DI container from scratch.


FlexDi

A small dependency injection container for .NET, inspired by BoDi.

Quick start

Comprehensive documentation is available in the FlexDi wiki. This is some minimal sample code to create a container, register a component and resolve it right away. Firstly though, you will want the FlexDi NuGet package.

using CSF.FlexDi;

var container = Container
    .CreateBuilder()
    // Call other methods from the builder if desired,
    // in order to configure container options & functionality
    .Build();

container.AddRegistrations(x => {
    x.RegisterType<MyServiceType>()
     .As<IServiceInterface>();
});

var myService = container.Resolve<IServiceInterface>();

BoDi compatibility

FlexDi may be used as a drop-in replacement for BoDi, via a compatibility package. The assembly contained within that NuGet package provides copies of BoDi's public types, exposing the same API. The FlexDi container wrapped by the BoDi compatibility assembly is preconfigured with options to mimic BoDi's functionality and behaviour.

The FlexDi wiki has a section dedicated to using FlexDi as a replacement for BoDi.

Copyright and license

FlexDi is the copyright of various authors. It is released under the terms of the Apache License v2.

Continuous integration status

CI builds are configured via AppVeyor for both Linux & Windows.

AppVeyor status

Quality Gate Status

Coverage