polished WcfQuickStart sample
This commit is contained in:
@@ -10,6 +10,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.WcfQuickStart.Server
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.WcfQuickStart.ServerWeb.2008", "src\Spring.WcfQuickStart.ServerWeb\Spring.WcfQuickStart.ServerWeb.2008.csproj", "{EEC5B531-104B-44E6-975B-44C0C8973405}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.WcfQuickStart.Contracts", "src\Spring.WcfQuickStart.Contracts\Spring.WcfQuickStart.Contracts.csproj", "{53263837-0643-45FE-96A2-46D425E1A36F}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.WcfQuickStart.Aspects", "src\Spring.WcfQuickStart.Aspects\Spring.WcfQuickStart.Aspects.csproj", "{B52BBAA3-1B30-4905-827C-1D81EBA56A15}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|.NET = Debug|.NET
|
||||
@@ -50,6 +54,26 @@ Global
|
||||
{EEC5B531-104B-44E6-975B-44C0C8973405}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{EEC5B531-104B-44E6-975B-44C0C8973405}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{EEC5B531-104B-44E6-975B-44C0C8973405}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{53263837-0643-45FE-96A2-46D425E1A36F}.Debug|.NET.ActiveCfg = Debug|Any CPU
|
||||
{53263837-0643-45FE-96A2-46D425E1A36F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{53263837-0643-45FE-96A2-46D425E1A36F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{53263837-0643-45FE-96A2-46D425E1A36F}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{53263837-0643-45FE-96A2-46D425E1A36F}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{53263837-0643-45FE-96A2-46D425E1A36F}.Release|.NET.ActiveCfg = Release|Any CPU
|
||||
{53263837-0643-45FE-96A2-46D425E1A36F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{53263837-0643-45FE-96A2-46D425E1A36F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{53263837-0643-45FE-96A2-46D425E1A36F}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{53263837-0643-45FE-96A2-46D425E1A36F}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{B52BBAA3-1B30-4905-827C-1D81EBA56A15}.Debug|.NET.ActiveCfg = Debug|Any CPU
|
||||
{B52BBAA3-1B30-4905-827C-1D81EBA56A15}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B52BBAA3-1B30-4905-827C-1D81EBA56A15}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B52BBAA3-1B30-4905-827C-1D81EBA56A15}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{B52BBAA3-1B30-4905-827C-1D81EBA56A15}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{B52BBAA3-1B30-4905-827C-1D81EBA56A15}.Release|.NET.ActiveCfg = Release|Any CPU
|
||||
{B52BBAA3-1B30-4905-827C-1D81EBA56A15}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B52BBAA3-1B30-4905-827C-1D81EBA56A15}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{B52BBAA3-1B30-4905-827C-1D81EBA56A15}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{B52BBAA3-1B30-4905-827C-1D81EBA56A15}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Spring.WcfQuickStart.Aspects")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Spring.WcfQuickStart.Aspects")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2008")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("24dd4f90-8ade-4961-b2d2-b799b12ca5cc")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -1,6 +1,4 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
using AopAlliance.Intercept;
|
||||
|
||||
namespace Spring.WcfQuickStart
|
||||
@@ -0,0 +1,66 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.30729</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{B52BBAA3-1B30-4905-827C-1D81EBA56A15}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Spring.WcfQuickStart</RootNamespace>
|
||||
<AssemblyName>Spring.WcfQuickStart.Aspects</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkSubset>
|
||||
</TargetFrameworkSubset>
|
||||
</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="Spring.Aop, Version=1.2.0.20336, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\bin\net\2.0\debug\Spring.Aop.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Spring.Core, Version=1.2.0.20336, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\bin\net\2.0\debug\Spring.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Xml.Linq">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data.DataSetExtensions">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="SimplePerformanceInterceptor.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -1,10 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
|
||||
<configSections>
|
||||
<sectionGroup name="spring">
|
||||
<section name="context" type="Spring.Context.Support.ContextHandler, Spring.Core"/>
|
||||
<section name="objects" type="Spring.Context.Support.DefaultSectionHandler, Spring.Core" />
|
||||
<section name="objects" type="Spring.Context.Support.DefaultSectionHandler, Spring.Core"/>
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
|
||||
@@ -12,10 +12,10 @@
|
||||
|
||||
<context>
|
||||
<!-- Make sure 'http://localhost:2637/Spring.WcfQuickStart.ServerWeb/' web application is running -->
|
||||
<resource uri="assembly://Spring.WcfQuickStart.ClientApp/Spring.WcfQuickStart.Config/ServerWeb.xml" />
|
||||
<resource uri="assembly://Spring.WcfQuickStart.ClientApp/Spring.WcfQuickStart.Config/ServerWeb.xml"/>
|
||||
|
||||
<!-- Make sure 'Spring.WcfQuickStart.ServerApp' console application is running and listening. -->
|
||||
<resource uri="assembly://Spring.WcfQuickStart.ClientApp/Spring.WcfQuickStart.Config/ServerApp.xml" />
|
||||
<resource uri="assembly://Spring.WcfQuickStart.ClientApp/Spring.WcfQuickStart.Config/ServerApp.xml"/>
|
||||
</context>
|
||||
|
||||
</spring>
|
||||
@@ -24,34 +24,21 @@
|
||||
|
||||
<bindings>
|
||||
<basicHttpBinding>
|
||||
<binding name="basicHttpBinding1" closeTimeout="00:01:00"
|
||||
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
|
||||
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
|
||||
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
|
||||
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
|
||||
useDefaultWebProxy="true">
|
||||
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
|
||||
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
|
||||
<binding name="basicHttpBinding1" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
|
||||
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
|
||||
<security mode="None">
|
||||
<transport clientCredentialType="None" proxyCredentialType="None"
|
||||
realm="" />
|
||||
<message clientCredentialType="UserName" algorithmSuite="Default" />
|
||||
<transport clientCredentialType="None" proxyCredentialType="None" realm=""/>
|
||||
<message clientCredentialType="UserName" algorithmSuite="Default"/>
|
||||
</security>
|
||||
</binding>
|
||||
</basicHttpBinding>
|
||||
</bindings>
|
||||
|
||||
<client>
|
||||
<endpoint name="serverWebCalculatorEndpoint"
|
||||
address="http://localhost:2637/Spring.WcfQuickStart.ServerWeb/Calculator.svc"
|
||||
binding="basicHttpBinding" bindingConfiguration="basicHttpBinding1"
|
||||
contract="Spring.WcfQuickStart.ICalculator" />
|
||||
<endpoint name="serverAppCalculatorEndpoint"
|
||||
address="http://localhost:8000/Spring.WcfQuickStart/service"
|
||||
binding="basicHttpBinding" bindingConfiguration="basicHttpBinding1"
|
||||
contract="Spring.WcfQuickStart.ICalculator" />
|
||||
<endpoint name="serverWebCalculatorEndpoint" address="http://localhost:2637/Spring.WcfQuickStart.ServerWeb/Calculator.svc" binding="basicHttpBinding" bindingConfiguration="basicHttpBinding1" contract="Spring.WcfQuickStart.ICalculator"/>
|
||||
<endpoint name="serverAppCalculatorEndpoint" address="http://localhost:8000/Spring.WcfQuickStart/service" binding="basicHttpBinding" bindingConfiguration="basicHttpBinding1" contract="Spring.WcfQuickStart.ICalculator"/>
|
||||
</client>
|
||||
|
||||
</system.serviceModel>
|
||||
|
||||
</configuration>
|
||||
<startup><supportedRuntime version="v2.0.50727"/></startup></configuration>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
<!-- returns ChannelFactory<ICalculator>("calculatorEndpoint").CreateChannel() -->
|
||||
<object id="serverAppCalculator"
|
||||
type="Spring.WcfQuickStart.ICalculator, Spring.WcfQuickStart.ClientApp"
|
||||
type="Spring.WcfQuickStart.ICalculator, Spring.WcfQuickStart.Contracts"
|
||||
factory-object="serverAppCalculatorChannelFactory"
|
||||
factory-method="CreateChannel" />
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
<!-- returns ChannelFactory<ICalculator>("calculatorEndpoint").CreateChannel() -->
|
||||
<object id="serverWebCalculator"
|
||||
type="Spring.WcfQuickStart.ICalculator, Spring.WcfQuickStart.ClientApp"
|
||||
type="Spring.WcfQuickStart.ICalculator, Spring.WcfQuickStart.Contracts"
|
||||
factory-object="serverWebCalculatorChannelFactory"
|
||||
factory-method="CreateChannel" />
|
||||
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
using System;
|
||||
using System.ServiceModel;
|
||||
|
||||
namespace Spring.WcfQuickStart
|
||||
{
|
||||
[ServiceContract(Namespace = "http://Spring.WcfQuickStart")]
|
||||
public interface ICalculator
|
||||
{
|
||||
[OperationContract]
|
||||
double Add(double n1, double n2);
|
||||
[OperationContract]
|
||||
double Subtract(double n1, double n2);
|
||||
[OperationContract]
|
||||
double Multiply(double n1, double n2);
|
||||
[OperationContract]
|
||||
double Divide(double n1, double n2);
|
||||
[OperationContract]
|
||||
string GetName();
|
||||
}
|
||||
}
|
||||
@@ -50,6 +50,7 @@ namespace Spring.WcfQuickStart.ClientApp
|
||||
Console.WriteLine("Divide(11, 2) : " + calculator.Divide(11, 2));
|
||||
Console.WriteLine("Multiply(2, 5) : " + calculator.Multiply(2, 5));
|
||||
Console.WriteLine("Subtract(7, 4) : " + calculator.Subtract(7, 4));
|
||||
Console.WriteLine("Power(2, 8) : " + calculator.Power(new BinaryOperationArgs(2,8)).Result);
|
||||
Console.WriteLine();
|
||||
}
|
||||
catch (Exception e)
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<OldToolsVersion>2.0</OldToolsVersion>
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v3.0</TargetFrameworkVersion>
|
||||
<PublishUrl>http://localhost/Spring.WcfQuickStart.ClientApp/</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Web</InstallFrom>
|
||||
@@ -30,6 +30,8 @@
|
||||
<IsWebBootstrapper>true</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
<TargetFrameworkSubset>
|
||||
</TargetFrameworkSubset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@@ -59,15 +61,11 @@
|
||||
<HintPath>..\..\..\..\..\bin\net\3.0\debug\Spring.Services.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ICalculator.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
@@ -97,6 +95,12 @@
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Config\ServerWeb.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Spring.WcfQuickStart.Contracts\Spring.WcfQuickStart.Contracts.csproj">
|
||||
<Project>{53263837-0643-45FE-96A2-46D425E1A36F}</Project>
|
||||
<Name>Spring.WcfQuickStart.Contracts</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
|
||||
namespace Spring.WcfQuickStart
|
||||
{
|
||||
public abstract class AbstractCalculatorService : ICalculator
|
||||
{
|
||||
private int sleepInSeconds;
|
||||
|
||||
public int SleepInSeconds
|
||||
{
|
||||
get { return sleepInSeconds; }
|
||||
set { sleepInSeconds = value; }
|
||||
}
|
||||
|
||||
public double Add(double n1, double n2)
|
||||
{
|
||||
Thread.Sleep(sleepInSeconds*1000);
|
||||
return n1 + n2;
|
||||
}
|
||||
|
||||
public double Subtract(double n1, double n2)
|
||||
{
|
||||
Thread.Sleep(sleepInSeconds * 1000);
|
||||
return n1 - n2;
|
||||
|
||||
}
|
||||
|
||||
public double Multiply(double n1, double n2)
|
||||
{
|
||||
Thread.Sleep(sleepInSeconds * 1000);
|
||||
return n1 * n2;
|
||||
|
||||
}
|
||||
|
||||
public double Divide(double n1, double n2)
|
||||
{
|
||||
Thread.Sleep(sleepInSeconds * 1000);
|
||||
return n1 / n2;
|
||||
|
||||
}
|
||||
|
||||
public OperationResult Power(BinaryOperationArgs args)
|
||||
{
|
||||
// do something
|
||||
return new OperationResult( Math.Pow(args.X, args.Y) );
|
||||
}
|
||||
|
||||
public abstract string GetName();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
using System;
|
||||
using System.ServiceModel;
|
||||
|
||||
namespace Spring.WcfQuickStart
|
||||
{
|
||||
[Serializable]
|
||||
public class BinaryOperationArgs
|
||||
{
|
||||
private double x;
|
||||
private double y;
|
||||
|
||||
public BinaryOperationArgs(double x, double y)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public double X
|
||||
{
|
||||
get { return x; }
|
||||
}
|
||||
|
||||
public double Y
|
||||
{
|
||||
get { return y; }
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class OperationResult
|
||||
{
|
||||
private double result;
|
||||
|
||||
public OperationResult(double result)
|
||||
{
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public double Result
|
||||
{
|
||||
get { return result; }
|
||||
}
|
||||
}
|
||||
|
||||
[ServiceContract(Namespace = "http://Spring.WcfQuickStart")]
|
||||
public interface ICalculator
|
||||
{
|
||||
[OperationContract]
|
||||
double Add(double n1, double n2);
|
||||
[OperationContract]
|
||||
double Subtract(double n1, double n2);
|
||||
[OperationContract]
|
||||
double Multiply(double n1, double n2);
|
||||
[OperationContract]
|
||||
double Divide(double n1, double n2);
|
||||
[OperationContract]
|
||||
string GetName();
|
||||
[OperationContract]
|
||||
OperationResult Power(BinaryOperationArgs args);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Spring.WcfQuickStart.Contracts")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Spring.WcfQuickStart.Contract")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2008")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("21c7f6d2-71a8-4d74-ae60-1d14cf79c977")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -0,0 +1,56 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.30729</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{53263837-0643-45FE-96A2-46D425E1A36F}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Spring.WcfQuickStart</RootNamespace>
|
||||
<AssemblyName>Spring.WcfQuickStart.Contracts</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkSubset>
|
||||
</TargetFrameworkSubset>
|
||||
</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="System" />
|
||||
<Reference Include="System.ServiceModel">
|
||||
<RequiredTargetFramework>3.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AbstractCalculatorService.cs" />
|
||||
<Compile Include="ICalculator.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -18,9 +18,9 @@
|
||||
|
||||
<parsers>
|
||||
|
||||
<parser namespace="http://www.springframework.net/aop"
|
||||
type="Spring.Aop.Config.AopNamespaceParser, Spring.Aop"
|
||||
schemaLocation="assembly://Spring.Aop/Spring.Aop.Config/spring-aop-1.1.xsd" />
|
||||
<!-- <parser namespace="http://www.springframework.net/aop"-->
|
||||
<!-- type="Spring.Aop.Config.AopNamespaceParser, Spring.Aop"-->
|
||||
<!-- schemaLocation="assembly://Spring.Aop/Spring.Aop.Config/spring-aop-1.1.xsd" />-->
|
||||
|
||||
</parsers>
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
<property name="pattern" value="Spring.WcfQuickStart.*"/>
|
||||
</object>
|
||||
|
||||
<object id="perfAdvice" type="Spring.WcfQuickStart.SimplePerformanceInterceptor, Spring.WcfQuickStart.ServerApp">
|
||||
<object id="perfAdvice" type="Spring.WcfQuickStart.SimplePerformanceInterceptor, Spring.WcfQuickStart.Aspects">
|
||||
<property name="Prefix" value="Service Layer Performance"/>
|
||||
</object>
|
||||
|
||||
|
||||
@@ -1,50 +1,12 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
//using System.ServiceModel;
|
||||
|
||||
namespace Spring.WcfQuickStart
|
||||
{
|
||||
//[ServiceBehavior(InstanceContextMode=InstanceContextMode.Single)]
|
||||
public class CalculatorService : ICalculator
|
||||
public class CalculatorService : AbstractCalculatorService
|
||||
{
|
||||
private int sleepInSeconds;
|
||||
|
||||
public int SleepInSeconds
|
||||
public override string GetName()
|
||||
{
|
||||
get { return sleepInSeconds; }
|
||||
set { sleepInSeconds = value; }
|
||||
}
|
||||
|
||||
public double Add(double n1, double n2)
|
||||
{
|
||||
Thread.Sleep(sleepInSeconds*1000);
|
||||
return n1 + n2;
|
||||
}
|
||||
|
||||
public double Subtract(double n1, double n2)
|
||||
{
|
||||
Thread.Sleep(sleepInSeconds * 1000);
|
||||
return n1 - n2;
|
||||
|
||||
}
|
||||
|
||||
public double Multiply(double n1, double n2)
|
||||
{
|
||||
Thread.Sleep(sleepInSeconds * 1000);
|
||||
return n1 * n2;
|
||||
|
||||
}
|
||||
|
||||
public double Divide(double n1, double n2)
|
||||
{
|
||||
Thread.Sleep(sleepInSeconds * 1000);
|
||||
return n1 / n2;
|
||||
|
||||
}
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
Thread.Sleep(sleepInSeconds * 1000);
|
||||
Thread.Sleep(SleepInSeconds * 1000);
|
||||
return "ServerApp Calculator";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
using System;
|
||||
using System.ServiceModel;
|
||||
|
||||
namespace Spring.WcfQuickStart
|
||||
{
|
||||
[ServiceContract(Namespace = "http://Spring.WcfQuickStart")]
|
||||
public interface ICalculator
|
||||
{
|
||||
[OperationContract]
|
||||
double Add(double n1, double n2);
|
||||
[OperationContract]
|
||||
double Subtract(double n1, double n2);
|
||||
[OperationContract]
|
||||
double Multiply(double n1, double n2);
|
||||
[OperationContract]
|
||||
double Divide(double n1, double n2);
|
||||
[OperationContract]
|
||||
string GetName();
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Spring.WcfQuickStart.ServerApp")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2007")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2008 The Spring for .NET Framework Team")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
|
||||
@@ -69,10 +69,8 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="CalculatorService.cs" />
|
||||
<Compile Include="ICalculator.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="SimplePerformanceInterceptor.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
@@ -94,6 +92,16 @@
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Spring.WcfQuickStart.Aspects\Spring.WcfQuickStart.Aspects.csproj">
|
||||
<Project>{B52BBAA3-1B30-4905-827C-1D81EBA56A15}</Project>
|
||||
<Name>Spring.WcfQuickStart.Aspects</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Spring.WcfQuickStart.Contracts\Spring.WcfQuickStart.Contracts.csproj">
|
||||
<Project>{53263837-0643-45FE-96A2-46D425E1A36F}</Project>
|
||||
<Name>Spring.WcfQuickStart.Contracts</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
||||
@@ -1,45 +1,13 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
|
||||
namespace Spring.WcfQuickStart
|
||||
{
|
||||
public class CalculatorService : ICalculator
|
||||
public class CalculatorService : AbstractCalculatorService
|
||||
{
|
||||
private int sleepInSeconds;
|
||||
|
||||
public int SleepInSeconds
|
||||
public override string GetName()
|
||||
{
|
||||
get { return sleepInSeconds; }
|
||||
set { sleepInSeconds = value; }
|
||||
}
|
||||
|
||||
public double Add(double n1, double n2)
|
||||
{
|
||||
Thread.Sleep(sleepInSeconds * 1000);
|
||||
return n1 + n2;
|
||||
}
|
||||
|
||||
public double Subtract(double n1, double n2)
|
||||
{
|
||||
Thread.Sleep(sleepInSeconds * 1000);
|
||||
return n1 - n2;
|
||||
}
|
||||
|
||||
public double Multiply(double n1, double n2)
|
||||
{
|
||||
Thread.Sleep(sleepInSeconds * 1000);
|
||||
return n1 * n2;
|
||||
}
|
||||
|
||||
public double Divide(double n1, double n2)
|
||||
{
|
||||
Thread.Sleep(sleepInSeconds * 1000);
|
||||
return n1 / n2;
|
||||
}
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
return "Web Calculator";
|
||||
Thread.Sleep(SleepInSeconds * 1000);
|
||||
return "WebApp Calculator";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using System;
|
||||
using System.ServiceModel;
|
||||
|
||||
namespace Spring.WcfQuickStart
|
||||
{
|
||||
[ServiceContract(Namespace = "http://Spring.WcfQuickStart")]
|
||||
public interface ICalculator
|
||||
{
|
||||
[OperationContract]
|
||||
double Add(double n1, double n2);
|
||||
[OperationContract]
|
||||
double Subtract(double n1, double n2);
|
||||
[OperationContract]
|
||||
double Multiply(double n1, double n2);
|
||||
[OperationContract]
|
||||
double Divide(double n1, double n2);
|
||||
[OperationContract]
|
||||
string GetName();
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
|
||||
using AopAlliance.Intercept;
|
||||
|
||||
namespace Spring.WcfQuickStart
|
||||
{
|
||||
public class SimplePerformanceInterceptor : IMethodInterceptor
|
||||
{
|
||||
private string prefix = "Invocation took";
|
||||
|
||||
public string Prefix
|
||||
{
|
||||
get { return prefix; }
|
||||
set { prefix = value; }
|
||||
}
|
||||
|
||||
#region IMethodInterceptor Members
|
||||
|
||||
public object Invoke(IMethodInvocation invocation)
|
||||
{
|
||||
DateTime start = DateTime.Now;
|
||||
try
|
||||
{
|
||||
return invocation.Proceed();
|
||||
}
|
||||
finally
|
||||
{
|
||||
DateTime stop = DateTime.Now;
|
||||
TimeSpan time = stop - start;
|
||||
Trace.WriteLine(Prefix + " " + time);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -43,8 +43,6 @@
|
||||
<HintPath>..\..\..\..\..\bin\net\3.0\debug\Spring.Services.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.ServiceModel">
|
||||
<RequiredTargetFramework>3.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
@@ -52,18 +50,24 @@
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Web.Services" />
|
||||
<Reference Include="System.EnterpriseServices" />
|
||||
<Reference Include="System.Web.Mobile" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Web.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="CalculatorService.cs" />
|
||||
<Compile Include="ICalculator.cs" />
|
||||
<Content Include="Calculator.svc" />
|
||||
<Compile Include="CalculatorService.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="SimplePerformanceInterceptor.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Spring.WcfQuickStart.Aspects\Spring.WcfQuickStart.Aspects.csproj">
|
||||
<Project>{B52BBAA3-1B30-4905-827C-1D81EBA56A15}</Project>
|
||||
<Name>Spring.WcfQuickStart.Aspects</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Spring.WcfQuickStart.Contracts\Spring.WcfQuickStart.Contracts.csproj">
|
||||
<Project>{53263837-0643-45FE-96A2-46D425E1A36F}</Project>
|
||||
<Name>Spring.WcfQuickStart.Contracts</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<property name="pattern" value="Spring.WcfQuickStart.*"/>
|
||||
</object>
|
||||
|
||||
<object id="perfAdvice" type="Spring.WcfQuickStart.SimplePerformanceInterceptor, Spring.WcfQuickStart.ServerWeb">
|
||||
<object id="perfAdvice" type="Spring.WcfQuickStart.SimplePerformanceInterceptor, Spring.WcfQuickStart.Aspects">
|
||||
<property name="Prefix" value="Service Layer Performance"/>
|
||||
</object>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user