Skip to content

Commit

Permalink
Update dictionary
Browse files Browse the repository at this point in the history
  • Loading branch information
usausa committed Sep 6, 2019
1 parent 9616a63 commit 03bf536
Show file tree
Hide file tree
Showing 12 changed files with 273 additions and 61 deletions.
2 changes: 1 addition & 1 deletion Example.GenericHost/Example.GenericHost.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<PackageReference Include="Microsoft.Extensions.Hosting" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="2.2.0" />
<PackageReference Include="Usa.Smart.Core" Version="1.7.7" />
<PackageReference Include="Usa.Smart.Core" Version="1.7.8-beta1" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Example.WebApplication/Example.WebApplication.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="2.2.6" />
<PackageReference Include="Usa.Smart.Core" Version="1.7.7" />
<PackageReference Include="Usa.Smart.Core" Version="1.7.8-beta1" />
<PackageReference Include="Usa.Smart.Data" Version="1.2.0" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion Smart.Resolver.Benchmark/Smart.Resolver.Benchmark.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.11.5" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="2.2.0" />
<PackageReference Include="Usa.Smart.Core" Version="1.7.7" />
<PackageReference Include="Usa.Smart.Core" Version="1.7.8-beta1" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="2.2.0" />
<PackageReference Include="Usa.Smart.Core" Version="1.7.7" />
<PackageReference Include="Usa.Smart.Core" Version="1.7.8-beta1" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Smart.Resolver.Tests/Smart.Resolver.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="Usa.Smart.Core" Version="1.7.7" />
<PackageReference Include="Usa.Smart.Core" Version="1.7.8-beta1" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
<PrivateAssets>all</PrivateAssets>
Expand Down
4 changes: 2 additions & 2 deletions Smart.Resolver.Xamarin/Smart.Resolver.Xamarin.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
Expand All @@ -9,7 +9,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Usa.Smart.Core" Version="1.7.7" />
<PackageReference Include="Usa.Smart.Core" Version="1.7.8-beta1" />
<PackageReference Include="Xamarin.Forms" Version="4.2.0.709249">
<NoWarn>NU1701</NoWarn>
</PackageReference>
Expand Down
1 change: 1 addition & 0 deletions Smart.Resolver.ruleset
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<Rule Id="SA1402" Action="Hidden" />
<Rule Id="SA1413" Action="Hidden" />
<Rule Id="SA1512" Action="Hidden" />
<Rule Id="SA1513" Action="Hidden" />
<Rule Id="SA1515" Action="Hidden" />
<Rule Id="SA1600" Action="Hidden" />
<Rule Id="SA1606" Action="Hidden" />
Expand Down
19 changes: 0 additions & 19 deletions Smart.Resolver/Resolver/RequestKey.cs

This file was deleted.

27 changes: 0 additions & 27 deletions Smart.Resolver/Resolver/RequestKeyComparer.cs

This file was deleted.

12 changes: 5 additions & 7 deletions Smart.Resolver/Resolver/SmartResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public FactoryEntry(bool canGet, Func<IResolver, object> single, Func<IResolver,

private readonly ThreadsafeTypeHashArrayMap<FactoryEntry> factoriesCache = new ThreadsafeTypeHashArrayMap<FactoryEntry>();

private readonly ThreadsafeHashArrayMap<RequestKey, FactoryEntry> factoriesCacheWithConstraint = new ThreadsafeHashArrayMap<RequestKey, FactoryEntry>(RequestKeyComparer.Default);
private readonly TypeConstraintHashArray<FactoryEntry> factoriesCacheWithConstraint = new TypeConstraintHashArray<FactoryEntry>();

private readonly ThreadsafeTypeHashArrayMap<Action<IResolver, object>[]> injectorsCache = new ThreadsafeTypeHashArrayMap<Action<IResolver, object>[]>();

Expand Down Expand Up @@ -194,10 +194,9 @@ private FactoryEntry FindFactoryEntry(Type type)
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private FactoryEntry FindFactoryEntry(Type type, IConstraint constraint)
{
var key = new RequestKey(type, constraint);
if (!factoriesCacheWithConstraint.TryGetValue(key, out var entry))
if (!factoriesCacheWithConstraint.TryGetValue(type, constraint, out var entry))
{
entry = factoriesCacheWithConstraint.AddIfNotExist(key, x => CreateFactoryEntry(x.Type, x.Constraint, this));
entry = factoriesCacheWithConstraint.AddIfNotExist(type, constraint, (t, c) => CreateFactoryEntry(t, c, this));
}

return entry;
Expand All @@ -217,10 +216,9 @@ private FactoryEntry FindFactoryEntry(IResolver resolver, Type type)
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private FactoryEntry FindFactoryEntry(IResolver resolver, Type type, IConstraint constraint)
{
var key = new RequestKey(type, constraint);
if (!factoriesCacheWithConstraint.TryGetValue(key, out var entry))
if (!factoriesCacheWithConstraint.TryGetValue(type, constraint, out var entry))
{
entry = factoriesCacheWithConstraint.AddIfNotExist(key, x => CreateFactoryEntry(x.Type, x.Constraint, resolver));
entry = factoriesCacheWithConstraint.AddIfNotExist(type, constraint, (t, c) => CreateFactoryEntry(t, c, resolver));
}

return entry;
Expand Down
Loading

0 comments on commit 03bf536

Please sign in to comment.