dadhi / DryIoc

DryIoc is fast, small, full-featured IoC Container for .NET
MIT License
988 stars 122 forks source link

`asResolutionRoot` does not affect validation #578

Closed Metadorius closed 1 year ago

Metadorius commented 1 year ago
            container.Register(
                Made.Of(_ => ServiceInfo.Of</*ILoggerFactory*/_SerilogLoggerFactory>(),
                    f => f.CreateLogger(Arg.Index<Type>(0)),
                    r => r.Parent.ImplementationType),
                setup: Setup.With(condition: r => r.Parent.ImplementationType != null,
                    asResolutionRoot: false));

Currently this does not affect validation whatsoever because there's no exclusion of AsResolutionRoot == true services in the Validate, which is counterintuitive.

Originally posted by @Metadorius in https://github.com/dadhi/DryIoc/issues/577#issuecomment-1564329201

One option would be amending the default validation condition which would probably make more sense in general conditions (usually there's not many resolution roots) but would break the default behavior: https://github.com/dadhi/DryIoc/issues/577#issuecomment-1564362538

Another option is:

I would rather filter all registrations based on the IsResolutionRoot, then if nothing found fallback to the current behavior.

Originally posted by @dadhi in https://github.com/dadhi/DryIoc/issues/577#issuecomment-1564377235

Metadorius commented 1 year ago

Hello! Been checking for a while, is there any ETA on the new version release with this and other recent fixes?

dadhi commented 1 year ago

@Metadorius No promises, but will try to release this weekend.

dadhi commented 1 year ago

@Metadorius Released right now, it might be some time until NuGet will index the 5.4.1 version.