Merge branch 'configuration2' · SharpRepository/SharpRepository@f9c35db · GitHub
Skip to content

Commit f9c35db

Browse files
author
Jeff Treuting
committed
Merge branch 'configuration2'
2 parents c06db2d + be8436c commit f9c35db

27 files changed

Lines changed: 4233 additions & 27 deletions
Lines changed: 6 additions & 0 deletions

SharpRepository.Db4oRepository/SharpRepository.Db4oRepository.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
</Compile>
4848
<Compile Include="Db4oConfigRepositoryFactory.cs" />
4949
<Compile Include="Db4oRepositoryConfiguration.cs" />
50+
<Compile Include="IAmInDb4oRepository.cs" />
5051
<Compile Include="Properties\AssemblyInfo.cs" />
5152
<Compile Include="Db4ORepository.cs" />
5253
<Compile Include="Db4ORepositoryBase.cs" />
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
namespace SharpRepository.Ef5Repository
2+
{
3+
public interface IAmInEf5Repository
4+
{
5+
}
6+
}

SharpRepository.Ef5Repository/SharpRepository.Ef5Repository.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
<Compile Include="Ef5Repository.cs" />
5555
<Compile Include="Ef5RepositoryBase.cs" />
5656
<Compile Include="Ef5RepositoryConfiguration.cs" />
57+
<Compile Include="IAmInEf5Repository.cs" />
5758
<Compile Include="Properties\AssemblyInfo.cs" />
5859
</ItemGroup>
5960
<ItemGroup>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
namespace SharpRepository.InMemoryRepository
2+
{
3+
public interface IAmInInMemoryRepository
4+
{
5+
}
6+
}

SharpRepository.InMemoryRepository/SharpRepository.InMemoryRepository.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
<Compile Include="..\CommonAssembly.cs">
4040
<Link>Properties\CommonAssembly.cs</Link>
4141
</Compile>
42+
<Compile Include="IAmInInMemoryRepository.cs" />
4243
<Compile Include="InMemoryConfigRepositoryFactory.cs" />
4344
<Compile Include="InMemoryRepository.cs" />
4445
<Compile Include="InMemoryRepositoryBase.cs" />
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// General Information about an assembly is controlled through the following
6+
// set of attributes. Change these attribute values to modify the information
7+
// associated with an assembly.
8+
[assembly: AssemblyTitle("SharpRepository.Ioc.StructureMap")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("")]
12+
[assembly: AssemblyProduct("SharpRepository.Ioc.StructureMap")]
13+
[assembly: AssemblyCopyright("Copyright © 2012")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// Setting ComVisible to false makes the types in this assembly not visible
18+
// to COM components. If you need to access a type in this assembly from
19+
// COM, set the ComVisible attribute to true on that type.
20+
[assembly: ComVisible(false)]
21+
22+
// The following GUID is for the ID of the typelib if this project is exposed to COM
23+
[assembly: Guid("0b6bc72d-739c-4afb-8485-d9c5bb8d59d5")]
24+
25+
// Version information for an assembly consists of the following four values:
26+
//
27+
// Major Version
28+
// Minor Version
29+
// Build Number
30+
// Revision
31+
//
32+
// You can specify all the values or you can default the Build and Revision Numbers
33+
// by using the '*' as shown below:
34+
// [assembly: AssemblyVersion("1.0.*")]
35+
[assembly: AssemblyVersion("1.0.0.0")]
36+
[assembly: AssemblyFileVersion("1.0.0.0")]
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{0B4BDC6D-6030-48FD-B22A-F9A9A7A00812}</ProjectGuid>
8+
<OutputType>Library</OutputType>
9+
<AppDesignerFolder>Properties</AppDesignerFolder>
10+
<RootNamespace>SharpRepository.Ioc.StructureMap</RootNamespace>
11+
<AssemblyName>SharpRepository.Ioc.StructureMap</AssemblyName>
12+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
13+
<FileAlignment>512</FileAlignment>
14+
</PropertyGroup>
15+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
16+
<DebugSymbols>true</DebugSymbols>
17+
<DebugType>full</DebugType>
18+
<Optimize>false</Optimize>
19+
<OutputPath>bin\Debug\</OutputPath>
20+
<DefineConstants>DEBUG;TRACE</DefineConstants>
21+
<ErrorReport>prompt</ErrorReport>
22+
<WarningLevel>4</WarningLevel>
23+
</PropertyGroup>
24+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
25+
<DebugType>pdbonly</DebugType>
26+
<Optimize>true</Optimize>
27+
<OutputPath>bin\Release\</OutputPath>
28+
<DefineConstants>TRACE</DefineConstants>
29+
<ErrorReport>prompt</ErrorReport>
30+
<WarningLevel>4</WarningLevel>
31+
</PropertyGroup>
32+
<ItemGroup>
33+
<Reference Include="StructureMap">
34+
<HintPath>..\packages\structuremap.2.6.4.1\lib\net40\StructureMap.dll</HintPath>
35+
</Reference>
36+
<Reference Include="System" />
37+
<Reference Include="System.Core" />
38+
</ItemGroup>
39+
<ItemGroup>
40+
<Compile Include="StructureMapExtensions.cs" />
41+
<Compile Include="Properties\AssemblyInfo.cs" />
42+
</ItemGroup>
43+
<ItemGroup>
44+
<None Include="packages.config" />
45+
</ItemGroup>
46+
<ItemGroup>
47+
<ProjectReference Include="..\SharpRepository.Repository\SharpRepository.Repository.csproj">
48+
<Project>{710dee79-25ce-4f68-b8b1-d08a135ad154}</Project>
49+
<Name>SharpRepository.Repository</Name>
50+
</ProjectReference>
51+
</ItemGroup>
52+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
53+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
54+
Other similar extension points exist, see Microsoft.Common.targets.
55+
<Target Name="BeforeBuild">
56+
</Target>
57+
<Target Name="AfterBuild">
58+
</Target>
59+
-->
60+
</Project>
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
using SharpRepository.Repository;
2+
using SharpRepository.Repository.Configuration;
3+
using StructureMap;
4+
using StructureMap.Pipeline;
5+
6+
namespace SharpRepository.Ioc.StructureMap
7+
{
8+
public static class StructureMapExtensions
9+
{
10+
public static LambdaInstance<object> ForRepositoriesUseSharpRepository(this IInitializationExpression initialization, string repositoryName = null)
11+
{
12+
initialization.Scan(scan => scan.IncludeNamespaceContainingType<IAmInRepository>());
13+
14+
return initialization.For(typeof(IRepository<,>))
15+
.Use(context =>
16+
{
17+
var entityType = context.BuildStack.Current.RequestedType.GetGenericArguments()[0];
18+
var keyType = context.BuildStack.Current.RequestedType.GetGenericArguments()[1];
19+
20+
return RepositoryFactory.GetInstance(entityType, keyType, repositoryName);
21+
}
22+
);
23+
}
24+
25+
public static LambdaInstance<object> ForRepositoriesUseSharpRepository(this IInitializationExpression initialization, ISharpRepositoryConfiguration configuration)
26+
{
27+
initialization.Scan(scan => scan.IncludeNamespaceContainingType<IAmInRepository>());
28+
29+
return initialization.For(typeof(IRepository<,>))
30+
.Use(context =>
31+
{
32+
var entityType = context.BuildStack.Current.RequestedType.GetGenericArguments()[0];
33+
var keyType = context.BuildStack.Current.RequestedType.GetGenericArguments()[1];
34+
35+
return RepositoryFactory.GetInstance(entityType, keyType, configuration);
36+
}
37+
);
38+
}
39+
}
40+
}
Lines changed: 4 additions & 0 deletions

0 commit comments

Comments
 (0)