Skip to content

Commit

Permalink
add castle support
Browse files Browse the repository at this point in the history
  • Loading branch information
ShiningRush committed Dec 21, 2017
1 parent d0e06dd commit 218f3ff
Show file tree
Hide file tree
Showing 30 changed files with 838 additions and 107 deletions.
32 changes: 30 additions & 2 deletions ServiceAnt.sln
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26730.16
VisualStudioVersion = 15.0.26730.8
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{0E041832-D5A5-4220-BD7D-95B03E66FF98}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{BDFDFA2C-DA6F-4405-B7B0-31D1B0997150}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceAnt.test", "test\ServiceAnt.test\ServiceAnt.test.csproj", "{C1990ED7-2C77-453E-BFE3-5F43E1654CF0}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceAnt.Test", "test\ServiceAnt.test\ServiceAnt.Test.csproj", "{C1990ED7-2C77-453E-BFE3-5F43E1654CF0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceAnt", "src\ServiceAnt\ServiceAnt.csproj", "{FB6688E2-094A-4D25-9EEA-85C3B7CCC4A2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceAnt.IocInstaller.Castle", "src\ServiceAnt.IocInstaller.Castle\ServiceAnt.IocInstaller.Castle.csproj", "{B64F120C-36DB-4D4A-8D30-D113CF70BF1A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceAnt.IocInstaller.Castle.Test", "test\ServiceAnt.IocInstaller.Castle.test\ServiceAnt.IocInstaller.Castle.Test.csproj", "{288BFA2A-3CA4-4C7A-B912-C953AD11863A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceAnt.IocInstaller.Autofac", "src\ServiceAnt.IocInstaller.Autofac\ServiceAnt.IocInstaller.Autofac.csproj", "{1FA5221C-9A54-4132-B7CF-CF7CC7A30E59}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceAnt.IocInstaller.Autofac.Test", "test\ServiceAnt.IocInstaller.Autofac.Test\ServiceAnt.IocInstaller.Autofac.Test.csproj", "{ABC9A287-31CC-422B-84A2-6EAEF0BD448E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -25,13 +33,33 @@ Global
{FB6688E2-094A-4D25-9EEA-85C3B7CCC4A2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FB6688E2-094A-4D25-9EEA-85C3B7CCC4A2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FB6688E2-094A-4D25-9EEA-85C3B7CCC4A2}.Release|Any CPU.Build.0 = Release|Any CPU
{B64F120C-36DB-4D4A-8D30-D113CF70BF1A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B64F120C-36DB-4D4A-8D30-D113CF70BF1A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B64F120C-36DB-4D4A-8D30-D113CF70BF1A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B64F120C-36DB-4D4A-8D30-D113CF70BF1A}.Release|Any CPU.Build.0 = Release|Any CPU
{288BFA2A-3CA4-4C7A-B912-C953AD11863A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{288BFA2A-3CA4-4C7A-B912-C953AD11863A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{288BFA2A-3CA4-4C7A-B912-C953AD11863A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{288BFA2A-3CA4-4C7A-B912-C953AD11863A}.Release|Any CPU.Build.0 = Release|Any CPU
{1FA5221C-9A54-4132-B7CF-CF7CC7A30E59}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1FA5221C-9A54-4132-B7CF-CF7CC7A30E59}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1FA5221C-9A54-4132-B7CF-CF7CC7A30E59}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1FA5221C-9A54-4132-B7CF-CF7CC7A30E59}.Release|Any CPU.Build.0 = Release|Any CPU
{ABC9A287-31CC-422B-84A2-6EAEF0BD448E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{ABC9A287-31CC-422B-84A2-6EAEF0BD448E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ABC9A287-31CC-422B-84A2-6EAEF0BD448E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{ABC9A287-31CC-422B-84A2-6EAEF0BD448E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{C1990ED7-2C77-453E-BFE3-5F43E1654CF0} = {BDFDFA2C-DA6F-4405-B7B0-31D1B0997150}
{FB6688E2-094A-4D25-9EEA-85C3B7CCC4A2} = {0E041832-D5A5-4220-BD7D-95B03E66FF98}
{B64F120C-36DB-4D4A-8D30-D113CF70BF1A} = {0E041832-D5A5-4220-BD7D-95B03E66FF98}
{288BFA2A-3CA4-4C7A-B912-C953AD11863A} = {BDFDFA2C-DA6F-4405-B7B0-31D1B0997150}
{1FA5221C-9A54-4132-B7CF-CF7CC7A30E59} = {0E041832-D5A5-4220-BD7D-95B03E66FF98}
{ABC9A287-31CC-422B-84A2-6EAEF0BD448E} = {BDFDFA2C-DA6F-4405-B7B0-31D1B0997150}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {52E5EADF-2B54-4C50-BF32-93550974966D}
Expand Down
30 changes: 30 additions & 0 deletions src/ServiceAnt.IocInstaller.Autofac/IocResolver.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using Autofac;
using ServiceAnt.Infrastructure.Dependency;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ServiceAnt.IocInstaller.Autofac
{
public class IocResolver : IIocResolver
{
private readonly IComponentContext _componentContext;

public IocResolver(IComponentContext componentContext)
{
_componentContext = componentContext;
}

public void Release(object obj)
{
//_componentContext
}

public T Resolve<T>(Type type)
{
return (T)_componentContext.Resolve(type);
}
}
}
36 changes: 36 additions & 0 deletions src/ServiceAnt.IocInstaller.Autofac/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("ServiceAnt.IocInstaller.Autofac")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("ServiceAnt.IocInstaller.Autofac")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]

// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("1fa5221c-9a54-4132-b7cf-cf7cc7a30e59")]

// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http:https://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{1FA5221C-9A54-4132-B7CF-CF7CC7A30E59}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ServiceAnt.IocInstaller.Autofac</RootNamespace>
<AssemblyName>ServiceAnt.IocInstaller.Autofac</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Autofac, Version=4.6.2.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
<HintPath>..\..\packages\Autofac.4.6.2\lib\net45\Autofac.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.IO.Compression.FileSystem" />
<Reference Include="System.Numerics" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="IocResolver.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ServiceAntModule.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ServiceAnt\ServiceAnt.csproj">
<Project>{fb6688e2-094a-4d25-9eea-85c3b7ccc4a2}</Project>
<Name>ServiceAnt</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
28 changes: 28 additions & 0 deletions src/ServiceAnt.IocInstaller.Autofac/ServiceAntModule.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using Autofac;
using ServiceAnt.Handler.Request;
using ServiceAnt.Infrastructure.Dependency;
using ServiceAnt.Subscription;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ServiceAnt.IocInstaller.Autofac
{
public class ServiceAntModule : Module
{
protected override void Load(ContainerBuilder builder)
{
builder.RegisterType<InProcessServiceBus>().AsSelf().As<IServiceBus>().SingleInstance();
builder.RegisterType<InMemorySubscriptionsManager>().AsSelf().As<ISubscriptionManager>().SingleInstance();
builder.RegisterType<InMemoryRequestHandlerManager>().AsSelf().As<IRequestHandlerManager>().SingleInstance();

builder.Register<IocResolver>(ctx =>
{
return new IocResolver(ctx.Resolve<IComponentContext>());
});

}
}
}
4 changes: 4 additions & 0 deletions src/ServiceAnt.IocInstaller.Autofac/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Autofac" version="4.6.2" targetFramework="net452" />
</packages>
30 changes: 30 additions & 0 deletions src/ServiceAnt.IocInstaller.Castle/IocResolver.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using Castle.Windsor;
using ServiceAnt.Infrastructure.Dependency;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ServiceAnt.IocInstaller.Castle
{
public class IocResolver : IIocResolver
{
private readonly IWindsorContainer _container;

public IocResolver(IWindsorContainer container)
{
_container = container;
}

public void Release(object obj)
{
_container.Release(obj);
}

public T Resolve<T>(Type type)
{
return (T)_container.Resolve(type);
}
}
}
36 changes: 36 additions & 0 deletions src/ServiceAnt.IocInstaller.Castle/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("ServiceAnt.IocInstaller.Castle")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("ServiceAnt.IocInstaller.Castle")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]

// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("b64f120c-36db-4d4a-8d30-d113cf70bf1a")]

// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http:https://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{B64F120C-36DB-4D4A-8D30-D113CF70BF1A}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ServiceAnt.IocInstaller.Castle</RootNamespace>
<AssemblyName>ServiceAnt.IocInstaller.Castle</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Castle.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<HintPath>..\..\packages\Castle.Core.4.2.0\lib\net45\Castle.Core.dll</HintPath>
</Reference>
<Reference Include="Castle.Windsor, Version=4.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<HintPath>..\..\packages\Castle.Windsor.4.1.0\lib\net45\Castle.Windsor.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Runtime.Remoting" />
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="IocResolver.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ServiceAntInstaller.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ServiceAnt\ServiceAnt.csproj">
<Project>{fb6688e2-094a-4d25-9eea-85c3b7ccc4a2}</Project>
<Name>ServiceAnt</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
Loading

0 comments on commit 218f3ff

Please sign in to comment.