From 39a1a2e159024d62ef4a7533821593ec5c20228e Mon Sep 17 00:00:00 2001 From: dadhi Date: Thu, 29 Aug 2019 15:22:00 +0000 Subject: [PATCH] Releasing v4.0.6 with the fixed #171 removing the direct parameter injection of IContainer (and implemented interfaces) and always rely on registration - perf reason is not applied anymore - it is fast enough --- BuildScripts/NuGetPublish.bat | 6 +- docs/DryIoc.Docs/VersionHistory.md | 4 ++ nuspecs/DryIoc.Internal.nuspec | 6 +- nuspecs/DryIoc.nuspec | 4 ++ src/DryIoc/Container.cs | 16 ----- src/DryIoc/DryIoc.csproj | 6 +- .../GHIssue171_Wrong_IContainer_resolved.cs | 62 +++++++++++++++++++ 7 files changed, 83 insertions(+), 21 deletions(-) create mode 100644 test/DryIoc.IssuesTests/GHIssue171_Wrong_IContainer_resolved.cs diff --git a/BuildScripts/NuGetPublish.bat b/BuildScripts/NuGetPublish.bat index 5b20f3c19..44fdec39f 100644 --- a/BuildScripts/NuGetPublish.bat +++ b/BuildScripts/NuGetPublish.bat @@ -4,9 +4,9 @@ set PACKAGES=..\.dist\packages set SOURCE=https://api.nuget.org/v3/index.json set /p APIKEY=<"..\ApiKey.txt" -dotnet nuget push "%PACKAGES%\DryIoc.dll.4.0.5.nupkg" -k %APIKEY% -s %SOURCE% -dotnet nuget push "%PACKAGES%\DryIoc.4.0.5.nupkg" -k %APIKEY% -s %SOURCE% -dotnet nuget push "%PACKAGES%\DryIoc.Internal.4.0.5.nupkg" -k %APIKEY% -s %SOURCE% +dotnet nuget push "%PACKAGES%\DryIoc.dll.4.0.6.nupkg" -k %APIKEY% -s %SOURCE% +dotnet nuget push "%PACKAGES%\DryIoc.4.0.6.nupkg" -k %APIKEY% -s %SOURCE% +dotnet nuget push "%PACKAGES%\DryIoc.Internal.4.0.6.nupkg" -k %APIKEY% -s %SOURCE% rem dotnet nuget push "%PACKAGES%\DryIocZero.4.1.0.nupkg" -k %APIKEY% -s %SOURCE% diff --git a/docs/DryIoc.Docs/VersionHistory.md b/docs/DryIoc.Docs/VersionHistory.md index 10af60cdf..6db4ea17f 100644 --- a/docs/DryIoc.Docs/VersionHistory.md +++ b/docs/DryIoc.Docs/VersionHistory.md @@ -1,6 +1,10 @@ Version History --------------- +## v4.0.6 Release notes / 2019-08-29 + +- fixed: #171 Wrong IContainer resolved + ## v4.0.5 Release notes / 2019-06-08 - fixed: #133 Validate method call hangs diff --git a/nuspecs/DryIoc.Internal.nuspec b/nuspecs/DryIoc.Internal.nuspec index 7d7a52e93..68a814591 100644 --- a/nuspecs/DryIoc.Internal.nuspec +++ b/nuspecs/DryIoc.Internal.nuspec @@ -2,7 +2,7 @@ DryIoc.Internal - 4.0.5 + 4.0.6 Maksim Volkau Copyright © 2013-2019 Maksim Volkau https://github.com/dadhi/DryIoc @@ -13,6 +13,10 @@ IoC Container Inversion-of-Control DI Dependency-Injection DRY Service-Provider Factory IoC Container Inversion-of-Control DI Dependency-Injection DRY Service-Provider Factory net35;net40;net45;netstandard1.0;netstandard1.3;netstandard2.0;portable-net45+win8+wpa81+wp8;portable-net40+win8+wpa81+wp8+sl5 DryIoc - 4.0.5 + 4.0.6 $(Product) @@ -16,6 +16,10 @@ IoC Container Inversion-of-Control DI Dependency-Injection DRY Service-Provider Factory FastExpressionCompiler ImTools (r => mainContainer, ifAlreadyRegistered: IfAlreadyRegistered.Replace); + + configureContainer.Register(); + + // init code ... + configureContainer.Resolve().Register(); + + Assert.False(configureContainer.IsRegistered()); + Assert.True(mainContainer.IsRegistered()); + Assert.AreSame(configureContainer.Resolve(), mainContainer); + } + + [Test] + public void Should_resolve_correct_registered_container_with_Use() + { + var mainContainer = new Container(); + var configureContainer = new Container(); + + configureContainer.Use(mainContainer); + + configureContainer.Register(); + + // init code ... + configureContainer.Resolve().Register(); + + Assert.False(configureContainer.IsRegistered()); + Assert.True(mainContainer.IsRegistered()); + Assert.AreSame(configureContainer.Resolve(), mainContainer); + } + + class Module + { + private readonly IContainer _container; + public Module(IContainer container) => + _container = container; + + public void Register() => + _container.Register(); + } + + public interface IFoo + { + } + + public class Foo : IFoo + { + } + } +}