Stefc
Stefc

Reputation: 73

What is the story about NanoContainer in NEventStore?

Is the there a story behind the Nanocontainer Class in NEventStore ? Is there a relation dependency to other IoC's or is it written from scratch by the author of NEventStore itself ?

I ask this because I like the smart approach of this class, it seem's to be a very lightweight IoC container and very easy to understand.

If there is a unique package with only this functionality it would be fine.

Upvotes: 0

Views: 207

Answers (1)

Steven
Steven

Reputation: 172646

Your question is one that only the developers of NEventStore can truly answer, but from the available source code it is easy to spot that the implementation is very minimalistic and 'lacks' many features that make it a 'real' DI container. As far as I can see, the code is not really based on any existing container, although in basic all containers look alike.

The NanoContainer implementation is meant to implement just enough functionality that NEventStore itself needs or what a user needs when changing the default behavior of the framework.

It's open to discussion what features a DI library should have to be a 'real' DI container, but IMO it should at least be able to auto-wire types (where dependencies are automatically injected into a constructor based on the constructor's arguments). NanoContainer doesn't support this. Other features it lacks are:

  • Batch-registration features
  • Registration of open-generic types
  • Support for (per request) scoped lifestyles.
  • Unregistered type resolution.
  • Registration of decorators or interception.
  • Support for releasing instances (disposing instances when done)
  • Diagnostic tools to spot common configuration problems

Whether or not you need those features of course depends on a lot of factors.

Upvotes: 2

Related Questions