Skip to content

Commit 742ddba

Browse files
committed
new packages for IoC packages
1 parent 241654a commit 742ddba

16 files changed

Lines changed: 121 additions & 66 deletions

SharpRepository.Ioc.Autofac/AutofacExtensions.cs

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,11 @@
22
using System.Collections.Generic;
33
using Autofac;
44
using Autofac.Core;
5+
using Microsoft.Extensions.Configuration;
56
using SharpRepository.Repository;
67
using SharpRepository.Repository.Configuration;
78
using SharpRepository.Repository.Ioc;
89

9-
#if NETSTANDARD2_0
10-
using Autofac.Extensions.DependencyInjection;
11-
#endif
12-
1310
namespace SharpRepository.Ioc.Autofac
1411
{
1512
public static class AutofacExtensions
@@ -24,14 +21,23 @@ public static class AutofacExtensions
2421
public static void RegisterSharpRepository(this ContainerBuilder containerBuilder, ISharpRepositoryConfiguration configuration, string repositoryName = null, params object[] lifetimeScopeTag)
2522
{
2623
containerBuilder.RegisterSource(new RepositoryRegistrationSource(configuration, repositoryName, lifetimeScopeTag));
24+
}
25+
26+
/// <summary>
27+
/// Registers in autofac container all IRepository and ICompoundKeyRepository resolutions.
28+
/// </summary>
29+
/// <param name="container"></param>
30+
/// <param name="configuration"></param>
31+
/// <param name="repositoryName"></param>
32+
/// <param name="lifetimeScopeTag">Accepts any MatchingScopeLifetimeTags scope enum tag</param>
33+
public static void RegisterSharpRepository(this ContainerBuilder containerBuilder, IConfigurationSection configurationSection, string repositoryName = null, params object[] lifetimeScopeTag)
34+
{
35+
if (configurationSection == null)
36+
throw new ConfigurationErrorsException("Configuration section not found.");
2737

28-
//var containerCopyBuilder = new ContainerBuilder();
38+
var configuration = RepositoryFactory.BuildSharpRepositoryConfiguation(configurationSection);
2939

30-
//#if NETSTANDARD2_0
31-
// RepositoryDependencyResolver.SetDependencyResolver(new AutofacServiceProvider(containerBuilder.Build()));
32-
//#else
33-
// RepositoryDependencyResolver.SetDependencyResolver(new AutofacRepositoryDependencyResolver(containerBuilder.Build()));
34-
//#endif
40+
containerBuilder.RegisterSharpRepository(configuration, repositoryName, lifetimeScopeTag);
3541
}
3642
}
3743
}

SharpRepository.Ioc.Autofac/AutofacRepositoryDependencyResolver.cs

Lines changed: 0 additions & 20 deletions
This file was deleted.

SharpRepository.Ioc.Autofac/SharpRepository.Ioc.Autofac.csproj

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@
1717
<Version>2.1.0</Version>
1818
</PropertyGroup>
1919
<ItemGroup>
20-
<PackageReference Include="Autofac" Version="4.9" />
21-
</ItemGroup>
22-
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
23-
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="5" />
20+
<PackageReference Include="Autofac" Version="[4.9,5.0)" />
2421
</ItemGroup>
2522
<ItemGroup>
2623
<ProjectReference Include="..\SharpRepository.Repository\SharpRepository.Repository.csproj" />

SharpRepository.Ioc.Microsoft.DependencyInjection/SharpRepository.Ioc.Microsoft.DependencyInjection.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,26 @@
55
<Description>Injects SharpRepository using StructureMap in your .NET Core apps or even using Microsoft.DependencyInjection library.</Description>
66
<Summary>Written in C#, includes support for various relational, document and object databases including Entity Framework, RavenDB, MongoDB, CouchDB and Db4o. SharpRepository includes Xml and InMemory repository implementations as well. SharpRepository offers built-in caching options for AppFabric, memcached and the standard System.Runtime.Caching. SharpRepository also supports Specifications, FetchStrategies, Batches and Traits!</Summary>
77
<PackageId>SharpRepository.Ioc.Microsoft.DependencyInjection</PackageId>
8-
<PackageVersion>2.0.2.2</PackageVersion>
9-
<PackageReleaseNotes>2.0.2: stable release</PackageReleaseNotes>
8+
<PackageVersion>2.1.0-prerelease</PackageVersion>
9+
<PackageReleaseNotes>2.1.0-prerelease: avoids installation for ASP.MVC Core 3</PackageReleaseNotes>
1010
<PackageTags>SharpRepository Repository IoC .NET Core Standard ServiceProvider Microsoft.DependencyInjection SharpRepository</PackageTags>
1111
<PackageIconUrl>https://user-images.githubusercontent.com/6349515/28491142-7b6350c4-6eeb-11e7-9c5b-e3b8ef1e73b8.png</PackageIconUrl>
1212
<PackageProjectUrl>https://github.com/SharpRepository/SharpRepository</PackageProjectUrl>
1313
<PackageLicenseUrl>https://raw.githubusercontent.com/SharpRepository/SharpRepository/master/license.txt</PackageLicenseUrl>
1414
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
1515
<RepositoryUrl>https://github.com/SharpRepository/SharpRepository.git</RepositoryUrl>
1616
<RepositoryType>git</RepositoryType>
17-
<Version>2.0.2</Version>
17+
<Version>2.10</Version>
1818
<Company>Omar Piani, Ben Griswold, Jeff Treuting</Company>
1919
</PropertyGroup>
2020
<ItemGroup>
2121
<PackageReference Include="StructureMap.Microsoft.DependencyInjection" Version="1.4.0" />
2222
</ItemGroup>
2323
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
24-
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.1.1" />
24+
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="[2.1,3.0.0)" />
2525
</ItemGroup>
2626
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard1.3'">
27-
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="1.1.1" />
27+
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="1.1" />
2828
</ItemGroup>
2929
<ItemGroup>
3030
<ProjectReference Include="..\SharpRepository.Repository\SharpRepository.Repository.csproj" />

SharpRepository.Ioc.Mvc/SharpRepository.Ioc.Mvc.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@
55
<Description>Injects SharpRepository using StructureMap in your Asp.Net Mvc 5 and WebApi 2 project</Description>
66
<Summary>Written in C#, includes support for various relational, document and object databases including Entity Framework, RavenDB, MongoDB, CouchDB and Db4o. SharpRepository includes Xml and InMemory repository implementations as well. SharpRepository offers built-in caching options for AppFabric, memcached and the standard System.Runtime.Caching. SharpRepository also supports Specifications, FetchStrategies, Batches and Traits!</Summary>
77
<PackageId>SharpRepository.Ioc.Mvc</PackageId>
8-
<PackageVersion>2.0.3.2</PackageVersion>
9-
<PackageReleaseNotes>2.0.3: updated package versions</PackageReleaseNotes>
8+
<PackageVersion>2.1.0-prerelease</PackageVersion>
9+
<PackageReleaseNotes>2.1.0: MVC 5.2.7</PackageReleaseNotes>
1010
<PackageTags>SharpRepository Repository IoC Mvc Mvc5 AspNet WebApi</PackageTags>
1111
<PackageIconUrl>https://user-images.githubusercontent.com/6349515/28491142-7b6350c4-6eeb-11e7-9c5b-e3b8ef1e73b8.png</PackageIconUrl>
1212
<PackageProjectUrl>https://github.com/SharpRepository/SharpRepository</PackageProjectUrl>
1313
<PackageLicenseUrl>https://raw.githubusercontent.com/SharpRepository/SharpRepository/master/license.txt</PackageLicenseUrl>
1414
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
1515
<RepositoryUrl>https://github.com/SharpRepository/SharpRepository.git</RepositoryUrl>
1616
<RepositoryType>git</RepositoryType>
17-
<Version>2.0.3</Version>
17+
<Version>2.1.0</Version>
1818
</PropertyGroup>
1919
<ItemGroup>
2020
<PackageReference Include="CommonServiceLocator" Version="2.0.4" />

SharpRepository.Ioc.Ninject/NinjectRepositoryExtensions.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using Ninject;
1+
using Microsoft.Extensions.Configuration;
2+
using Ninject;
23
using SharpRepository.Repository;
34
using SharpRepository.Repository.Configuration;
45
using System.Reflection;
@@ -7,6 +8,17 @@ namespace SharpRepository.Ioc.Ninject
78
{
89
public static class NinjectRepositoryExtensions
910
{
11+
public static void BindSharpRepository(this IKernel kernel, IConfigurationSection configurationSection, string repositoryName = null)
12+
{
13+
if (configurationSection == null)
14+
throw new ConfigurationErrorsException("Configuration section not found.");
15+
16+
var configuration = RepositoryFactory.BuildSharpRepositoryConfiguation(configurationSection);
17+
18+
kernel.BindSharpRepository(configuration, repositoryName)M
19+
}
20+
21+
1022
public static void BindSharpRepository(this IKernel kernel, ISharpRepositoryConfiguration configuration, string repositoryName = null)
1123
{
1224
kernel.Bind(typeof (IRepository<>)).ToMethod(context =>

SharpRepository.Ioc.Ninject/SharpRepository.Ioc.Ninject.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@
55
<Description>Configures Ninject to resolve IRepository as the right configured implementation of SharpRepository</Description>
66
<Summary>Written in C#, includes support for various relational, document and object databases including Entity Framework, RavenDB, MongoDB, CouchDB and Db4o. SharpRepository includes Xml and InMemory repository implementations as well. SharpRepository offers built-in caching options for AppFabric, memcached and the standard System.Runtime.Caching. SharpRepository also supports Specifications, FetchStrategies, Batches and Traits!</Summary>
77
<PackageId>SharpRepository.Ioc.Ninject</PackageId>
8-
<PackageVersion>2.0.2-alpha4</PackageVersion>
9-
<PackageReleaseNotes>2.0.2-alpha4: use of stable 3.3.4 package</PackageReleaseNotes>
8+
<PackageVersion>2.1.0-alpha</PackageVersion>
9+
<PackageReleaseNotes>2.1.0: removed dependency resolver</PackageReleaseNotes>
1010
<PackageTags>SharpRepository Repository IoC Ninject</PackageTags>
1111
<PackageIconUrl>https://user-images.githubusercontent.com/6349515/28491142-7b6350c4-6eeb-11e7-9c5b-e3b8ef1e73b8.png</PackageIconUrl>
1212
<PackageProjectUrl>https://github.com/SharpRepository/SharpRepository</PackageProjectUrl>
1313
<PackageLicenseUrl>https://raw.githubusercontent.com/SharpRepository/SharpRepository/master/license.txt</PackageLicenseUrl>
1414
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
1515
<RepositoryUrl>https://github.com/SharpRepository/SharpRepository.git</RepositoryUrl>
1616
<RepositoryType>git</RepositoryType>
17-
<Version>2.0.2</Version>
17+
<Version>2.1.2</Version>
1818
</PropertyGroup>
1919
<ItemGroup>
2020
<PackageReference Include="Ninject" Version="3.3.4" />

SharpRepository.Ioc.SimpleInjector/SharpRepository.Ioc.SimpleInjector.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@
55
<Description>Configures SimpleInjector to resolve IRepository as the right configured implementation of SharpRepository</Description>
66
<Summary>Written in C#, includes support for various relational, document and object databases including Entity Framework, RavenDB, MongoDB, CouchDB and Db4o. SharpRepository includes Xml and InMemory repository implementations as well. SharpRepository offers built-in caching options for AppFabric, memcached and the standard System.Runtime.Caching. SharpRepository also supports Specifications, FetchStrategies, Batches and Traits!</Summary>
77
<PackageId>SharpRepository.Ioc.SimpleInjector</PackageId>
8-
<PackageVersion>2.0.2-alpha4</PackageVersion>
9-
<PackageReleaseNotes>2.0.2-alpha4: targets standard 1.3 and 2.0</PackageReleaseNotes>
8+
<PackageVersion>2.1.0-alpha</PackageVersion>
9+
<PackageReleaseNotes>2.1.0: removed dependency resolver</PackageReleaseNotes>
1010
<PackageTags>SharpRepository Repository IoC SimpleInjector</PackageTags>
1111
<PackageIconUrl>https://user-images.githubusercontent.com/6349515/28491142-7b6350c4-6eeb-11e7-9c5b-e3b8ef1e73b8.png</PackageIconUrl>
1212
<PackageProjectUrl>https://github.com/SharpRepository/SharpRepository</PackageProjectUrl>
1313
<PackageLicenseUrl>https://raw.githubusercontent.com/SharpRepository/SharpRepository/master/license.txt</PackageLicenseUrl>
1414
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
1515
<RepositoryUrl>https://github.com/SharpRepository/SharpRepository.git</RepositoryUrl>
1616
<RepositoryType>git</RepositoryType>
17-
<Version>2.0.2-alpha4</Version>
17+
<Version>2.1.0</Version>
1818
</PropertyGroup>
1919
<ItemGroup>
20-
<PackageReference Include="SimpleInjector" Version="4.4.0" />
20+
<PackageReference Include="SimpleInjector" Version="4.7" />
2121
</ItemGroup>
2222
<ItemGroup>
2323
<ProjectReference Include="..\SharpRepository.Repository\SharpRepository.Repository.csproj" />

SharpRepository.Ioc.SimpleInjector/SimpleInjectorRepositoryExtensions.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using SharpRepository.Repository;
1+
using Microsoft.Extensions.Configuration;
2+
using SharpRepository.Repository;
23
using SharpRepository.Repository.Configuration;
34
using SimpleInjector;
45
using System.Reflection;
@@ -7,6 +8,16 @@ namespace SharpRepository.Ioc.SimpleInjector
78
{
89
public static class SimpleInjectorRepositoryExtensions
910
{
11+
public static void RegisterSharpRepository(this Container container, IConfigurationSection configurationSection, string repositoryName = null)
12+
{
13+
if (configurationSection == null)
14+
throw new ConfigurationErrorsException("Configuration section not found.");
15+
16+
var configuration = RepositoryFactory.BuildSharpRepositoryConfiguation(configurationSection);
17+
18+
container.RegisterSharpRepository(configuration, repositoryName);
19+
}
20+
1021
public static void RegisterSharpRepository(this Container container, ISharpRepositoryConfiguration configuration, string repositoryName = null)
1122
{
1223

SharpRepository.Ioc.StructureMap/SharpRepository.Ioc.StructureMap.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@
55
<Description>Configures Structurmap to resolve IRepository as the right configured implementation of SharpRepository</Description>
66
<Summary>Written in C#, includes support for various relational, document and object databases including Entity Framework, RavenDB, MongoDB, CouchDB and Db4o. SharpRepository includes Xml and InMemory repository implementations as well. SharpRepository offers built-in caching options for AppFabric, memcached and the standard System.Runtime.Caching. SharpRepository also supports Specifications, FetchStrategies, Batches and Traits!</Summary>
77
<PackageId>SharpRepository.Ioc.StructureMap</PackageId>
8-
<PackageVersion>2.0.4.1</PackageVersion>
9-
<PackageReleaseNotes>2.0.4: StructureMap 4.7 package</PackageReleaseNotes>
8+
<PackageVersion>2.1.0-prerelease</PackageVersion>
9+
<PackageReleaseNotes>2.1.0: removed dependency resolver</PackageReleaseNotes>
1010
<PackageTags>SharpRepository Repository IoC StructureMap 4.7</PackageTags>
1111
<PackageIconUrl>https://user-images.githubusercontent.com/6349515/28491142-7b6350c4-6eeb-11e7-9c5b-e3b8ef1e73b8.png</PackageIconUrl>
1212
<PackageProjectUrl>https://github.com/SharpRepository/SharpRepository</PackageProjectUrl>
1313
<PackageLicenseUrl>https://raw.githubusercontent.com/SharpRepository/SharpRepository/master/license.txt</PackageLicenseUrl>
1414
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
1515
<RepositoryUrl>https://github.com/SharpRepository/SharpRepository.git</RepositoryUrl>
1616
<RepositoryType>git</RepositoryType>
17-
<Version>2.0.4</Version>
17+
<Version>2.1.0</Version>
1818
</PropertyGroup>
1919
<ItemGroup>
2020
<PackageReference Include="StructureMap" Version="4.7.0" />

0 commit comments

Comments
 (0)