Skip to content

Commit

Permalink
releasing DryIoc v4.2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
maximv committed Jul 4, 2020
1 parent 3eb968e commit 6384027
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 28 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ DryIoc is fast, small, full-featured IoC Container for .NET
- __DryIoc__ (source code) [![NuGet Badge](https://buildstats.info/nuget/DryIoc)](https://www.nuget.org/packages/DryIoc)
- __DryIoc.Internal__ (source code with public types made internal) [![NuGet Badge](https://buildstats.info/nuget/DryIoc.Internal)](https://www.nuget.org/packages/DryIoc.Internal)

- [Release Notes](https://github.com/dadhi/DryIoc/releases/tag/v4.2.2) :: [Previous Versions](https://github.com/dadhi/DryIoc/blob/master/docs/DryIoc.Docs/VersionHistory.md)
- [Release Notes](https://github.com/dadhi/DryIoc/releases/tag/v4.2.3) :: [Previous Versions](https://github.com/dadhi/DryIoc/blob/master/docs/DryIoc.Docs/VersionHistory.md)
- [Extensions and Companions](Extensions.md)
- [Documentation][WikiHome]
- [Contribution guide](CONTRIBUTING.md)
Expand Down
8 changes: 3 additions & 5 deletions docs/DryIoc.Docs/Home.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,10 @@ Get from NuGet:
- __DryIoc__ (source code) [![NuGet Badge](https://buildstats.info/nuget/DryIoc)](https://www.nuget.org/packages/DryIoc)
- __DryIoc.Internal__ (source code with public types made internal) [![NuGet Badge](https://buildstats.info/nuget/DryIoc.Internal)](https://www.nuget.org/packages/DryIoc.Internal)

## v4.2.2 / 2020-07-02
## v4.2.3 Bug-fix release

- fixed: #288 Recursive resolution ignores current scope .Use() instance
- small perf improvements
- fixed: #289 Think how to make Use to directly replace scoped service without special asResolutionCall setup

[Release Notes](https://github.com/dadhi/DryIoc/releases/tag/v4.2.2)
[Release Notes](https://github.com/dadhi/DryIoc/releases/tag/v4.2.3)

### [Previous Versions](VersionHistory.md)

4 changes: 4 additions & 0 deletions docs/DryIoc.Docs/VersionHistory.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Version History
---------------

## v4.2.3 Bug-fix release / 2020-07-04

- fixed: #289 Think how to make Use to directly replace scoped service without special asResolutionCall setup

## v4.2.2 Bug-fix release / 2020-07-02

- fixed: #288 Recursive resolution ignores current scope .Use() instance
Expand Down
6 changes: 5 additions & 1 deletion nuspecs/DryIoc.Internal.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata minClientVersion="3.3.0">
<id>DryIoc.Internal</id>
<version>4.2.2</version>
<version>4.2.3</version>

<authors>Maksim Volkau</authors>

Expand All @@ -15,6 +15,10 @@
<tags>IoC Container Inversion-of-Control DI Dependency-Injection DRY Service-Provider Factory</tags>
<releaseNotes>
<![CDATA[
## v4.2.3 Bug-fix release
- fixed: #289 Think how to make Use to directly replace scoped service without special asResolutionCall setup
## v4.2.2 Bug-fix release
- fixed: #288 Recursive resolution ignores current scope .Use() instance
Expand Down
6 changes: 5 additions & 1 deletion nuspecs/DryIoc.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata minClientVersion="3.3.0">
<id>DryIoc</id>
<version>4.2.2</version>
<version>4.2.3</version>
<authors>Maksim Volkau</authors>
<copyright>Copyright © 2013-2020 Maksim Volkau</copyright>
<projectUrl>https://github.com/dadhi/DryIoc</projectUrl>
Expand All @@ -13,6 +13,10 @@
<tags>IoC Container Inversion-of-Control DI Dependency-Injection DRY Service-Provider Factory</tags>
<releaseNotes>
<![CDATA[
## v4.2.3 Bug-fix release
- fixed: #289 Think how to make Use to directly replace scoped service without special asResolutionCall setup
## v4.2.2 Bug-fix release
- fixed: #288 Recursive resolution ignores current scope .Use() instance
Expand Down
21 changes: 3 additions & 18 deletions src/DryIoc/Container.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11486,24 +11486,9 @@ public void SetOrAdd(int id, object item)
var itemRef = new ImMapEntry<object>(id, item);
ref var map = ref _maps[id & MAP_COUNT_SUFFIX_MASK];
var oldMap = map;
var newMap = oldMap.AddOrKeepEntry(itemRef);
if (Interlocked.CompareExchange(ref map, newMap, oldMap) == oldMap)
{
if (newMap == oldMap)
{
itemRef = newMap.GetEntryOrDefault(id);
if (ReferenceEquals(itemRef.Value, item))
return;
itemRef.Value = item;
}
}
else
{
// todo: @incomplete
var anotherItemRef = Ref.SwapAndGetNewValue(ref map, itemRef, (x, i) => x.AddOrKeepEntry(itemRef)).GetEntryOrDefault(id);
if (!ReferenceEquals(anotherItemRef, itemRef))
anotherItemRef.Value = item;
}
var newMap = oldMap.AddOrUpdateEntry(itemRef);
if (Interlocked.CompareExchange(ref map, newMap, oldMap) != oldMap)
Ref.Swap(ref map, itemRef, (x, i) => x.AddOrUpdateEntry(i));

if (item is IDisposable disp && disp != this)
AddUnorderedDisposable(disp);
Expand Down
6 changes: 5 additions & 1 deletion src/DryIoc/DryIoc.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<TargetFrameworks Condition="'$(NoLegacy)' == 'true'">net45;netstandard1.0;netstandard1.3;netstandard2.0</TargetFrameworks>

<Product>DryIoc</Product>
<VersionPrefix>4.2.2</VersionPrefix>
<VersionPrefix>4.2.3</VersionPrefix>
<VersionSuffix></VersionSuffix>

<AssemblyName>$(Product)</AssemblyName>
Expand All @@ -17,6 +17,10 @@
<PackageTags>IoC Container Inversion-of-Control DI Dependency-Injection DRY Service-Provider Factory FastExpressionCompiler ImTools</PackageTags>
<PackageReleaseNotes>
<![CDATA[
## v4.2.3 Bug-fix release
- fixed: #289 Think how to make Use to directly replace scoped service without special asResolutionCall setup
## v4.2.2 Bug-fix release
- fixed: #288 Recursive resolution ignores current scope .Use() instance
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,16 @@ public void Test()

using (var __ = c.OpenScope())
{
var innerChildNormal = c.Resolve<Child>();

// inject instance
var inner = c.Resolve<IResolverContext>();
inner.CurrentScope.SetOrAdd(childFactory.FactoryID, outerChildInstance);

// direct type resolution works
var innerChildInstance = c.Resolve<Child>();
Assert.AreSame(outerChildInstance, innerChildInstance);
Assert.AreNotSame(innerChildNormal, innerChildInstance);
Assert.AreSame(outerChildInstance, innerChildInstance);

// recursive type resolution skips the instance and calls the factory even though the instance is placed to the current scope
var innerParentInstance = c.Resolve<Parent>();
Expand Down

0 comments on commit 6384027

Please sign in to comment.