Skip to content

Pure.DI and preserving module level encapsulation #34

Answered by NikolayPianikov
ekalchev asked this question in Q&A
Discussion options

You must be logged in to vote

In short, your proposed scenario does not fit the pure DI paradigm. There is no complexity to analyze all types, including those not visible in the project where DI is configured. But what to do with them next? Pure.DI generates code in the pure DI paradigm, which is just a set of nested constructors, for example:

partial class Composition
{
    private object _lockObject = new object();
    private Random _randomSingleton;    
    
    public Program Root
    {
      get
      {
        Func<State> stateFunc = new Func<State>(() =>
        {
          if (_randomSingleton == null)
          {
            lock (_lockObject)
            {
              if (_randomSingleton == null)

Replies: 4 comments 9 replies

Comment options

You must be logged in to vote
4 replies
@ekalchev
Comment options

@ekalchev
Comment options

@NikolayPianikov
Comment options

Answer selected by ekalchev
@NikolayPianikov
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@NikolayPianikov
Comment options

@ekalchev
Comment options

Comment options

You must be logged in to vote
3 replies
@ekalchev
Comment options

@NikolayPianikov
Comment options

@NikolayPianikov
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants