Skip to content
This repository was archived by the owner on Apr 18, 2020. It is now read-only.

Commit 5fc6c84

Browse files
authored
Merge pull request #22 from osoykan/dev
dev to master
2 parents 4167800 + 1afcfda commit 5fc6c84

File tree

51 files changed

+194
-546
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+194
-546
lines changed

Autofac.Extras.IocManager.v3.ncrunchsolution

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
<Value>test\Autofac.Extras.IocManager.DynamicProxy.Tests\Autofac.Extras.IocManager.DynamicProxy.Tests.csproj:net452</Value>
99
<Value>test\Autofac.Extras.IocManager.TestBase\Autofac.Extras.IocManager.TestBase.csproj:net452</Value>
1010
<Value>test\Autofac.Extras.IocManager.Tests\Autofac.Extras.IocManager.Tests.csproj:net452</Value>
11+
<Value>test\Autofac.Extras.IocManager.DynamicProxy.Tests\Autofac.Extras.IocManager.DynamicProxy.Tests.csproj:netcoreapp1.0</Value>
12+
<Value>test\Autofac.Extras.IocManager.TestBase\Autofac.Extras.IocManager.TestBase.csproj:netcoreapp1.0</Value>
13+
<Value>test\Autofac.Extras.IocManager.Tests\Autofac.Extras.IocManager.Tests.csproj:netcoreapp1.0</Value>
1114
</MetricsExclusionList>
1215
<SolutionConfigured>True</SolutionConfigured>
1316
</Settings>

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ Autofac.Extras.IocManager [![Build status](https://ci.appveyor.com/api/projects/
44

55
|Package|Status|
66
|:-:|:-:|
7-
|Autofac.Extras.IocManager| [![NuGet version](https://badge.fury.io/nu/Autofac.Extras.IocManager.svg)](https://badge.fury.io/nu/Autofac.Extras.IocManager)|
8-
|Autofac.Extras.IocManager.DynamicProxy|[![NuGet version](https://badge.fury.io/nu/Autofac.Extras.IocManager.DynamicProxy.svg)](https://badge.fury.io/nu/Autofac.Extras.IocManager.DynamicProxy)|
7+
|Autofac.Extras.IocManager| [![NuGet version](https://badge.fury.io/nu/Autofac.Extras.IocManager.svg)](https://badge.fury.io/nu/Autofac.Extras.IocManager) [![NuGet Pre Release](https://img.shields.io/nuget/vpre/Autofac.Extras.IocManager.svg)](https://www.nuget.org/packages/Autofac.Extras.IocManager/)|
8+
|Autofac.Extras.IocManager.DynamicProxy|[![NuGet version](https://badge.fury.io/nu/Autofac.Extras.IocManager.DynamicProxy.svg)](https://badge.fury.io/nu/Autofac.Extras.IocManager.DynamicProxy) [![NuGet Pre Release](https://img.shields.io/nuget/vpre/Autofac.Extras.IocManager.svg)](https://www.nuget.org/packages/Autofac.Extras.IocManager.DynamicProxy/)|
99

1010
Autofac.Extras.IocManager allows Autofac Container to be portable. It also provides entire resolve methods which belong to Autofac Container and also provides conventional registration mechanism. IocManager is the best alternative to [common Service Locator anti-pattern](http://blog.ploeh.dk/2010/02/03/ServiceLocatorisanAnti-Pattern/).
1111

appveyor.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ deploy:
4444
branch: master
4545
api_key:
4646
secure: liSTqN52OJQy9fZJk6gubSgYBAy4EXcEPCDSCLJ/3T9cZufzpTwvBlGPLX+iP2n9
47+
- provider: NuGet
48+
on:
49+
branch: dotnet-standard
50+
api_key:
51+
secure: liSTqN52OJQy9fZJk6gubSgYBAy4EXcEPCDSCLJ/3T9cZufzpTwvBlGPLX+iP2n9
4752

4853
artifacts:
4954
- path: '**\.nupkg/'

common.props

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<Project>
22
<PropertyGroup>
3-
<VersionPrefix>2.2.4</VersionPrefix>
4-
<TargetFramework>net452</TargetFramework>
3+
<VersionPrefix>3.0.0</VersionPrefix>
54
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
65
<NoWarn>$(NoWarn);CS1591</NoWarn>
76
<PackageIconUrl>https://raw.githubusercontent.com/osoykan/Stove/master/stove.png</PackageIconUrl>

src/Autofac.Extras.IocManager.DynamicProxy/Autofac.Extras.IocManager.DynamicProxy.csproj

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
<PropertyGroup>
66
<AssemblyName>Autofac.Extras.IocManager.DynamicProxy</AssemblyName>
7+
<TargetFrameworks>net452;netstandard1.6</TargetFrameworks>
78
<PackageId>Autofac.Extras.IocManager.DynamicProxy</PackageId>
89
<PackageTags>Autofac;DynamicProxy;Resolve;Composition Root</PackageTags>
910
<Description>DynamicProxy integration for Autofac.Extras.IocManager</Description>
@@ -19,6 +20,10 @@
1920
<PackagePath>lib/net452/</PackagePath>
2021
<Pack>true</Pack>
2122
</None>
23+
<None Update="bin\Release\netstandard1.6\Autofac.Extras.IocManager.DynamicProxy.pdb">
24+
<PackagePath>lib/netstandard1.6/</PackagePath>
25+
<Pack>true</Pack>
26+
</None>
2227
</ItemGroup>
2328

2429
<ItemGroup>
@@ -36,4 +41,8 @@
3641
<Reference Include="Microsoft.CSharp" />
3742
</ItemGroup>
3843

44+
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
45+
<PackageReference Include="NETStandard.Library" Version="1.6.1" />
46+
</ItemGroup>
47+
3948
</Project>

src/Autofac.Extras.IocManager.DynamicProxy/AutofacInterceptionExtensions.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Collections.Generic;
33
using System.Linq;
4+
using System.Reflection;
45

56
using Autofac.Builder;
67
using Autofac.Core;
@@ -54,12 +55,12 @@ private static void ApplyInterception(Type[] interceptorTypes, IActivatingEventA
5455
{
5556
Type type = e.Instance.GetType();
5657

57-
if (e.Component.Services.OfType<IServiceWithType>().Any(swt => !swt.ServiceType.IsVisible) || type.Namespace == "Castle.Proxies")
58+
if (e.Component.Services.OfType<IServiceWithType>().Any(swt => !swt.ServiceType.GetTypeInfo().IsVisible) || type.Namespace == "Castle.Proxies")
5859
{
5960
return;
6061
}
6162

62-
Type[] proxiedInterfaces = type.GetInterfaces().Where(i => i.IsVisible).ToArray();
63+
Type[] proxiedInterfaces = type.GetInterfaces().Where(i => i.GetTypeInfo().IsVisible).ToArray();
6364
if (!proxiedInterfaces.Any())
6465
{
6566
return;

src/Autofac.Extras.IocManager/Autofac.Extras.IocManager.csproj

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
<PropertyGroup>
66
<AssemblyName>Autofac.Extras.IocManager</AssemblyName>
7+
<TargetFrameworks>net452;netstandard1.6</TargetFrameworks>
78
<PackageId>Autofac.Extras.IocManager</PackageId>
89
<PackageTags>Autofac;Resolve;Composition Root;Service Locator</PackageTags>
910
<Description>Provides abstractions to Autofac's registration and resolvings.</Description>
@@ -19,16 +20,23 @@
1920
<PackagePath>lib/net452/</PackagePath>
2021
<Pack>true</Pack>
2122
</None>
23+
<None Update="bin\Release\netstandard1.6\Autofac.Extras.IocManager.pdb">
24+
<PackagePath>lib/netstandard1.6/</PackagePath>
25+
<Pack>true</Pack>
26+
</None>
2227
</ItemGroup>
2328

2429
<ItemGroup>
2530
<PackageReference Include="Autofac" Version="4.5.0" />
26-
<PackageReference Include="FluentAssemblyScanner" Version="1.0.7" />
2731
</ItemGroup>
2832

2933
<ItemGroup Condition=" '$(TargetFramework)' == 'net452' ">
3034
<Reference Include="System" />
3135
<Reference Include="Microsoft.CSharp" />
3236
</ItemGroup>
3337

38+
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
39+
<PackageReference Include="NETStandard.Library" Version="1.6.1" />
40+
</ItemGroup>
41+
3442
</Project>

src/Autofac.Extras.IocManager/AutofacExtensions.cs

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
using System.Linq;
44
using System.Reflection;
55

6-
using Autofac.Builder;
7-
using Autofac.Features.Scanning;
8-
96
namespace Autofac.Extras.IocManager
107
{
118
public static class AutofacExtensions
@@ -17,30 +14,12 @@ public static class AutofacExtensions
1714
/// <returns></returns>
1815
internal static IEnumerable<TypedParameter> GetTypedResolvingParameters(this object @this)
1916
{
20-
foreach (PropertyInfo propertyInfo in @this.GetType().GetProperties())
17+
foreach (PropertyInfo propertyInfo in @this.GetType().GetTypeInfo().GetProperties())
2118
{
2219
yield return new TypedParameter(propertyInfo.PropertyType, propertyInfo.GetValue(@this, null));
2320
}
2421
}
2522

26-
/// <summary>
27-
/// Finds and registers as DefaultInterfaces to container conventionally.
28-
/// </summary>
29-
/// <typeparam name="TLimit">The type of the limit.</typeparam>
30-
/// <param name="registration">The registration.</param>
31-
/// <returns></returns>
32-
/// <exception cref="System.ArgumentNullException">registration</exception>
33-
public static IRegistrationBuilder<TLimit, ScanningActivatorData, DynamicRegistrationStyle>
34-
AsDefaultInterfacesWithSelf<TLimit>(this IRegistrationBuilder<TLimit, ScanningActivatorData, DynamicRegistrationStyle> registration)
35-
{
36-
if (registration == null)
37-
{
38-
throw new ArgumentNullException(nameof(registration));
39-
}
40-
41-
return registration.As(t => (IEnumerable<Type>)t.GetDefaultInterfacesWithSelf());
42-
}
43-
4423
/// <summary>
4524
/// Finds all types based <see cref="TLifetime" /> in given <see cref="Assembly" />
4625
/// </summary>
@@ -64,24 +43,24 @@ internal static void RegisterApplyingLifetime<TLifetime>(this ContainerBuilder b
6443
{
6544
List<Type> defaultInterfaces = typeToRegister.GetDefaultInterfaces().ToList();
6645

67-
if (typeToRegister.IsGenericTypeDefinition)
46+
if (typeToRegister.GetTypeInfo().IsGenericTypeDefinition)
6847
{
69-
List<Type> defaultGenerics = defaultInterfaces.Where(t => t.IsGenericType).ToList();
48+
List<Type> defaultGenerics = defaultInterfaces.Where(t => t.GetTypeInfo().IsGenericType).ToList();
7049
AddStartableIfPossible(typeToRegister, defaultGenerics);
7150
builder.RegisterGeneric(typeToRegister)
7251
.As(defaultGenerics.ToArray())
7352
.AsSelf()
74-
.PropertiesAutowired(new DoNotInjectAttributePropertySelector(), true)
53+
.WithPropertyInjection()
7554
.ApplyLifeStyle(typeof(TLifetime));
7655
}
7756
else
7857
{
79-
List<Type> defaults = defaultInterfaces.Where(t => !t.IsGenericType).ToList();
58+
List<Type> defaults = defaultInterfaces.Where(t => !t.GetTypeInfo().IsGenericType).ToList();
8059
AddStartableIfPossible(typeToRegister, defaults);
8160
builder.RegisterType(typeToRegister)
8261
.As(defaults.ToArray())
8362
.AsSelf()
84-
.PropertiesAutowired(new DoNotInjectAttributePropertySelector(), true)
63+
.WithPropertyInjection()
8564
.ApplyLifeStyle(typeof(TLifetime));
8665
}
8766
}

src/Autofac.Extras.IocManager/DecoratorService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public object Decorate(Type serviceType, object implementation, IResolverContext
2525
serviceType,
2626
t =>
2727
{
28-
MethodInfo genericMethodInfo = GetType()
28+
MethodInfo genericMethodInfo = GetType().GetTypeInfo()
2929
.GetMethods()
3030
.Single(mi => mi.IsGenericMethodDefinition && mi.Name == "Decorate");
3131
MethodInfo methodInfo = genericMethodInfo.MakeGenericMethod(t);

src/Autofac.Extras.IocManager/ModuleRegistration.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public class ModuleRegistration : IModuleRegistration
1919
/// Initializes a new instance of the <see cref="ModuleRegistration" /> class.
2020
/// </summary>
2121
/// <param name="iocBuilder">The ioc builder.</param>
22-
public ModuleRegistration(IocBuilder iocBuilder)
22+
public ModuleRegistration(IIocBuilder iocBuilder)
2323
{
2424
this.iocBuilder = iocBuilder;
2525
}

0 commit comments

Comments
 (0)