Skip to content

Commit

Permalink
Update library
Browse files Browse the repository at this point in the history
  • Loading branch information
usausa committed Sep 1, 2017
1 parent 036ddb7 commit 12570f0
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 53 deletions.
9 changes: 3 additions & 6 deletions Smart.Resolver.AspNetCore/Smart.Resolver.AspNetCore.csproj
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard1.6</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<CodeAnalysisRuleSet>..\Smart.Resolver.ruleset</CodeAnalysisRuleSet>
<RootNamespace>Smart</RootNamespace>
<Version>1.3.0</Version>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.3" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.0.0" />
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="1.1.0" />
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="1.1.0" />
<PackageReference Include="StyleCop.Analyzers" Version="1.0.2" />
<PackageReference Include="System.Runtime.Analyzers" Version="1.1.0" />
<PackageReference Include="System.Runtime.InteropServices.Analyzers" Version="1.1.0" />
<PackageReference Include="Usa.Smart.Core" Version="1.0.0-beta10" />
<PackageReference Include="Usa.Smart.Core" Version="1.0.1-beta01" />
</ItemGroup>

<ItemGroup>
Expand Down
9 changes: 3 additions & 6 deletions Smart.Resolver.Tests/Smart.Resolver.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework>
<TargetFramework>netcoreapp2.0</TargetFramework>
<CodeAnalysisRuleSet>..\Smart.Resolver.ruleset</CodeAnalysisRuleSet>
<RootNamespace>Smart</RootNamespace>
<Version>1.3.0</Version>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="1.1.0" />
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="1.1.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0" />
<PackageReference Include="StyleCop.Analyzers" Version="1.0.2" />
<PackageReference Include="System.Runtime.Analyzers" Version="1.1.0" />
<PackageReference Include="System.Runtime.InteropServices.Analyzers" Version="1.1.0" />
<PackageReference Include="Usa.Smart.Core" Version="1.0.0-beta10" />
<PackageReference Include="Usa.Smart.Core" Version="1.0.1-beta01" />
<PackageReference Include="xunit" Version="2.2.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0" />
</ItemGroup>
Expand Down
11 changes: 5 additions & 6 deletions Smart.Resolver.Xamarin/Smart.Resolver.Xamarin.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard1.1</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8+wpa81;</PackageTargetFallback>
<CodeAnalysisRuleSet>..\Smart.Resolver.ruleset</CodeAnalysisRuleSet>
<RootNamespace>Smart</RootNamespace>
Expand All @@ -10,12 +10,11 @@

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="1.1.0" />
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="1.1.0" />
<PackageReference Include="StyleCop.Analyzers" Version="1.0.2" />
<PackageReference Include="System.Runtime.Analyzers" Version="1.1.0" />
<PackageReference Include="System.Runtime.InteropServices.Analyzers" Version="1.1.0" />
<PackageReference Include="Usa.Smart.Core" Version="1.0.0-beta10" />
<PackageReference Include="Xamarin.Forms" Version="2.3.4.247" />
<PackageReference Include="Usa.Smart.Core" Version="1.0.1-beta01" />
<PackageReference Include="Xamarin.Forms" Version="2.3.4.270">
<NoWarn>NU1701</NoWarn>
</PackageReference>
</ItemGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions Smart.Resolver.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=DAB17E8D_002DD166_002D4714_002D9FE7_002D194E3FC1DFAB/@EntryIndexedValue">ExplicitlyExcluded</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ExplicitCallerInfoArgument/@EntryIndexedValue">HINT</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ForCanBeConvertedToForeach/@EntryIndexedValue">HINT</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=InheritdocConsiderUsage/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=JoinNullCheckWithUsage/@EntryIndexedValue">HINT</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantNameQualifier/@EntryIndexedValue">HINT</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateInstanceFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String></wpf:ResourceDictionary>
27 changes: 0 additions & 27 deletions Smart.Resolver/Resolver/Metadatas/ActivatorCache.cs

This file was deleted.

15 changes: 13 additions & 2 deletions Smart.Resolver/Resolver/Metadatas/MetadataFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,19 @@ public class MetadataFactory : IMetadataFactory

private static readonly Type ListType = typeof(IList<>);

private readonly IAccessorFactory accessorFactory;

private readonly ConcurrentDictionary<Type, TypeMetadata> metadatas = new ConcurrentDictionary<Type, TypeMetadata>();

/// <summary>
///
/// </summary>
/// <param name="accessorFactory"></param>
public MetadataFactory(IAccessorFactory accessorFactory)
{
this.accessorFactory = accessorFactory;
}

/// <summary>
///
/// </summary>
Expand Down Expand Up @@ -106,9 +117,9 @@ private static ParameterMetadata CreateParameterMetadata(ParameterInfo pi)
/// </summary>
/// <param name="pi"></param>
/// <returns></returns>
private static PropertyMetadata CreatePropertyMetadata(PropertyInfo pi)
private PropertyMetadata CreatePropertyMetadata(PropertyInfo pi)
{
return new PropertyMetadata(pi.ToAccessor(), CreateConstraint(pi.GetCustomAttributes<ConstraintAttribute>()));
return new PropertyMetadata(accessorFactory.CreateAccessor(pi), CreateConstraint(pi.GetCustomAttributes<ConstraintAttribute>()));
}

/// <summary>
Expand Down
5 changes: 4 additions & 1 deletion Smart.Resolver/Resolver/Providers/StandardProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ public class StandardProvider : IProvider
{
private readonly IInjector[] injectors;

private readonly IActivatorFactory activatorFactory;

private readonly TypeMetadata metadata;

private ConstructorMetadata constructor;
Expand Down Expand Up @@ -48,6 +50,7 @@ public StandardProvider(Type type, IComponentContainer components)

TargetType = type;
injectors = components.GetAll<IInjector>().ToArray();
activatorFactory = components.Get<IActivatorFactory>();
metadata = components.Get<IMetadataFactory>().GetMetadata(TargetType);
}

Expand All @@ -61,7 +64,7 @@ public object Create(IKernel kernel, IBinding binding)

if (activator == null)
{
Interlocked.CompareExchange(ref activator, ActivatorCache.GetActivator(constructor.Constructor, binding.Scope != null), null);
Interlocked.CompareExchange(ref activator, activatorFactory.CreateActivator(constructor.Constructor), null);
}

var arguments = ResolveParameters(kernel, binding, constructor);
Expand Down
3 changes: 3 additions & 0 deletions Smart.Resolver/Resolver/ResolverConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Linq;

using Smart.ComponentModel;
using Smart.Reflection;
using Smart.Resolver.Bindings;
using Smart.Resolver.Configs;
using Smart.Resolver.Handlers;
Expand All @@ -25,6 +26,8 @@ public class ResolverConfig : IResolverConfig, IBindingRoot
/// </summary>
public ResolverConfig()
{
Components.Add<IActivatorFactory>(TypeMetadataFactory.Default);
Components.Add<IAccessorFactory>(TypeMetadataFactory.Default);
Components.Add<IMetadataFactory, MetadataFactory>();
Components.Add<IMissingHandler, SelfMissingHandler>();
Components.Add<IMissingHandler, OpenGenericMissingHandler>();
Expand Down
7 changes: 2 additions & 5 deletions Smart.Resolver/Smart.Resolver.csproj
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard1.1</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<CodeAnalysisRuleSet>..\Smart.Resolver.ruleset</CodeAnalysisRuleSet>
<RootNamespace>Smart</RootNamespace>
<Version>1.3.0</Version>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="1.1.0" />
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="1.1.0" />
<PackageReference Include="StyleCop.Analyzers" Version="1.0.2" />
<PackageReference Include="System.Runtime.Analyzers" Version="1.1.0" />
<PackageReference Include="System.Runtime.InteropServices.Analyzers" Version="1.1.0" />
<PackageReference Include="Usa.Smart.Core" Version="1.0.0-beta10" />
<PackageReference Include="Usa.Smart.Core" Version="1.0.1-beta01" />
</ItemGroup>

</Project>

0 comments on commit 12570f0

Please sign in to comment.