Skip to content

Commit 115c7a2

Browse files
committed
Implement ServiceProxyAttribute and ServiceProxyRegistrationBehavior
1 parent 1cfe8c2 commit 115c7a2

8 files changed

Lines changed: 151 additions & 0 deletions

File tree

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" 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>{C378E838-1688-484B-A35E-A95E003E28BC}</ProjectGuid>
8+
<OutputType>Library</OutputType>
9+
<AppDesignerFolder>Properties</AppDesignerFolder>
10+
<RootNamespace>AppBootEx</RootNamespace>
11+
<AssemblyName>AppBootEx</AssemblyName>
12+
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
13+
<FileAlignment>512</FileAlignment>
14+
<TargetFrameworkProfile />
15+
</PropertyGroup>
16+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
17+
<DebugSymbols>true</DebugSymbols>
18+
<DebugType>full</DebugType>
19+
<Optimize>false</Optimize>
20+
<OutputPath>bin\Debug\</OutputPath>
21+
<DefineConstants>DEBUG;TRACE</DefineConstants>
22+
<ErrorReport>prompt</ErrorReport>
23+
<WarningLevel>4</WarningLevel>
24+
</PropertyGroup>
25+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
26+
<DebugType>pdbonly</DebugType>
27+
<Optimize>true</Optimize>
28+
<OutputPath>bin\Release\</OutputPath>
29+
<DefineConstants>TRACE</DefineConstants>
30+
<ErrorReport>prompt</ErrorReport>
31+
<WarningLevel>4</WarningLevel>
32+
</PropertyGroup>
33+
<ItemGroup>
34+
<Reference Include="iQuarc.AppBoot, Version=2.0.3.2, Culture=neutral, processorArchitecture=MSIL">
35+
<HintPath>..\packages\iQuarc.AppBoot.2.0.3-disposables002\lib\net45\iQuarc.AppBoot.dll</HintPath>
36+
</Reference>
37+
<Reference Include="iQuarc.SystemEx, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
38+
<HintPath>..\packages\iQuarc.SystemEx.1.0.0.0\lib\net40\iQuarc.SystemEx.dll</HintPath>
39+
</Reference>
40+
<Reference Include="Microsoft.Practices.ServiceLocation, Version=1.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
41+
<HintPath>..\packages\CommonServiceLocator.1.3\lib\portable-net4+sl5+netcore45+wpa81+wp8\Microsoft.Practices.ServiceLocation.dll</HintPath>
42+
</Reference>
43+
<Reference Include="System" />
44+
<Reference Include="System.Core" />
45+
<Reference Include="System.Xml.Linq" />
46+
<Reference Include="System.Data.DataSetExtensions" />
47+
<Reference Include="Microsoft.CSharp" />
48+
<Reference Include="System.Data" />
49+
<Reference Include="System.Net.Http" />
50+
<Reference Include="System.Xml" />
51+
</ItemGroup>
52+
<ItemGroup>
53+
<Compile Include="Properties\AssemblyInfo.cs" />
54+
<Compile Include="ServiceProxyAttribute.cs" />
55+
<Compile Include="ServiceProxyRegistrationBehavior.cs" />
56+
</ItemGroup>
57+
<ItemGroup>
58+
<None Include="packages.config" />
59+
</ItemGroup>
60+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
61+
</Project>
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("AppBootEx")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("")]
12+
[assembly: AssemblyProduct("AppBootEx")]
13+
[assembly: AssemblyCopyright("Copyright © 2017")]
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("c378e838-1688-484b-a35e-a95e003e28bc")]
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: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using System;
2+
using iQuarc.AppBoot;
3+
4+
namespace AppBootEx
5+
{
6+
[AttributeUsage(AttributeTargets.Class)]
7+
public sealed class ServiceProxyAttribute : Attribute
8+
{
9+
public ServiceProxyAttribute(Type exportType)
10+
{
11+
ExportType = exportType;
12+
}
13+
14+
public Type ExportType { get; private set; }
15+
}
16+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using iQuarc.AppBoot;
5+
using iQuarc.SystemEx;
6+
7+
namespace AppBootEx
8+
{
9+
public sealed class ServiceProxyRegistrationBehavior : IRegistrationBehavior
10+
{
11+
public IEnumerable<ServiceInfo> GetServicesFrom(Type type)
12+
{
13+
IEnumerable<ServiceProxyAttribute> attributes = type.GetAttributes<ServiceProxyAttribute>(false);
14+
return attributes.Select(a => new ServiceInfo(a.ExportType, type, string.Empty, Lifetime.AlwaysNew));
15+
}
16+
}
17+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<packages>
3+
<package id="CommonServiceLocator" version="1.3" targetFramework="net462" />
4+
<package id="iQuarc.AppBoot" version="2.0.3-disposables002" targetFramework="net462" />
5+
<package id="iQuarc.SystemEx" version="1.0.0.0" targetFramework="net462" />
6+
</packages>

InterProcessCommunication/TradingApp/ConsoleUi/ConsoleUi.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@
7474
<None Include="packages.config" />
7575
</ItemGroup>
7676
<ItemGroup>
77+
<ProjectReference Include="..\AppBootEx\AppBootEx.csproj">
78+
<Project>{C378E838-1688-484B-A35E-A95E003E28BC}</Project>
79+
<Name>AppBootEx</Name>
80+
</ProjectReference>
7781
<ProjectReference Include="..\Modules\_Contracts\Contracts.csproj">
7882
<Project>{19297424-954D-42F5-AC38-6F22A25EA682}</Project>
7983
<Name>Contracts</Name>

InterProcessCommunication/TradingApp/Infrastructure/Proxies/Proxies.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@
6767
<Compile Include="QuotationServiceProxy.cs" />
6868
</ItemGroup>
6969
<ItemGroup>
70+
<ProjectReference Include="..\..\AppBootEx\AppBootEx.csproj">
71+
<Project>{C378E838-1688-484B-A35E-A95E003E28BC}</Project>
72+
<Name>AppBootEx</Name>
73+
</ProjectReference>
7074
<ProjectReference Include="..\..\Modules\_Contracts\Contracts.csproj">
7175
<Project>{19297424-954D-42F5-AC38-6F22A25EA682}</Project>
7276
<Name>Contracts</Name>

InterProcessCommunication/TradingApp/TradingApp.sln

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Proxies", "Infrastructure\P
3737
EndProject
3838
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Infra.Hosts", "Infrastructure\Common\Infra.Hosts\Infra.Hosts.csproj", "{C4A8A9D9-CF33-466C-829F-39DE80E99F38}"
3939
EndProject
40+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppBootEx", "AppBootEx\AppBootEx.csproj", "{C378E838-1688-484B-A35E-A95E003E28BC}"
41+
EndProject
4042
Global
4143
GlobalSection(SolutionConfigurationPlatforms) = preSolution
4244
Debug|Any CPU = Debug|Any CPU
@@ -75,6 +77,10 @@ Global
7577
{C4A8A9D9-CF33-466C-829F-39DE80E99F38}.Debug|Any CPU.Build.0 = Debug|Any CPU
7678
{C4A8A9D9-CF33-466C-829F-39DE80E99F38}.Release|Any CPU.ActiveCfg = Release|Any CPU
7779
{C4A8A9D9-CF33-466C-829F-39DE80E99F38}.Release|Any CPU.Build.0 = Release|Any CPU
80+
{C378E838-1688-484B-A35E-A95E003E28BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
81+
{C378E838-1688-484B-A35E-A95E003E28BC}.Debug|Any CPU.Build.0 = Debug|Any CPU
82+
{C378E838-1688-484B-A35E-A95E003E28BC}.Release|Any CPU.ActiveCfg = Release|Any CPU
83+
{C378E838-1688-484B-A35E-A95E003E28BC}.Release|Any CPU.Build.0 = Release|Any CPU
7884
EndGlobalSection
7985
GlobalSection(SolutionProperties) = preSolution
8086
HideSolutionNode = FALSE
@@ -89,5 +95,6 @@ Global
8995
{4110E4B3-FCBC-46E5-9F1C-C7158E08FC3E} = {72D6C915-B820-4AC3-89F5-10E2431C81BD}
9096
{B235C485-07B0-4BB5-A27A-B79DADC576AA} = {13B36249-6775-4B1D-ACE1-E5671AD1FCE1}
9197
{C4A8A9D9-CF33-466C-829F-39DE80E99F38} = {13B36249-6775-4B1D-ACE1-E5671AD1FCE1}
98+
{C378E838-1688-484B-A35E-A95E003E28BC} = {13B36249-6775-4B1D-ACE1-E5671AD1FCE1}
9299
EndGlobalSection
93100
EndGlobal

0 commit comments

Comments
 (0)