diff --git a/examples/Spring/Spring.WcfQuickStart/Spring.WcfQuickStart.2008.sln b/examples/Spring/Spring.WcfQuickStart/Spring.WcfQuickStart.2008.sln new file mode 100644 index 00000000..14460efa --- /dev/null +++ b/examples/Spring/Spring.WcfQuickStart/Spring.WcfQuickStart.2008.sln @@ -0,0 +1,129 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.WcfQuickStart.ClientApp.2008", "src\Spring.WcfQuickStart.ClientApp\Spring.WcfQuickStart.ClientApp.2008.csproj", "{D58B3101-4433-49C5-B41B-51134424FC42}" + ProjectSection(WebsiteProperties) = preProject + Debug.AspNetCompiler.Debug = "True" + Release.AspNetCompiler.Debug = "False" + EndProjectSection +EndProject +Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "D:\...\Spring.WcfQuickStart.Web.2008\", "src\Spring.WcfQuickStart.Web.2008\", "{B71CEEE1-9C92-4C79-94BE-46D6D4CDE95A}" + ProjectSection(WebsiteProperties) = preProject + ProjectReferences = "{710961A3-0DF4-49E4-A26E-F5B9C044AC84}|Spring.Core.dll;{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}|Spring.Services.dll;" + Debug.AspNetCompiler.VirtualPath = "/Spring.WcfQuickStart.Web.2008" + Debug.AspNetCompiler.PhysicalPath = "src\Spring.WcfQuickStart.Web.2008\" + Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\Spring.WcfQuickStart.Web.2008\" + Debug.AspNetCompiler.Updateable = "true" + Debug.AspNetCompiler.ForceOverwrite = "true" + Debug.AspNetCompiler.FixedNames = "false" + Debug.AspNetCompiler.Debug = "True" + Release.AspNetCompiler.VirtualPath = "/Spring.WcfQuickStart.Web.2008" + Release.AspNetCompiler.PhysicalPath = "src\Spring.WcfQuickStart.Web.2008\" + Release.AspNetCompiler.TargetPath = "PrecompiledWeb\Spring.WcfQuickStart.Web.2008\" + Release.AspNetCompiler.Updateable = "true" + Release.AspNetCompiler.ForceOverwrite = "true" + Release.AspNetCompiler.FixedNames = "false" + Release.AspNetCompiler.Debug = "False" + VWDPort = "2637" + DefaultWebSiteLanguage = "Visual C#" + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Core.2005", "..\..\..\src\Spring\Spring.Core\Spring.Core.2005.csproj", "{710961A3-0DF4-49E4-A26E-F5B9C044AC84}" + ProjectSection(WebsiteProperties) = preProject + Debug.AspNetCompiler.Debug = "True" + Release.AspNetCompiler.Debug = "False" + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Services.2008", "..\..\..\src\Spring\Spring.Services\Spring.Services.2008.csproj", "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" + ProjectSection(WebsiteProperties) = preProject + Debug.AspNetCompiler.Debug = "True" + Release.AspNetCompiler.Debug = "False" + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.WcfQuickStart.ServerApp.2008", "src\Spring.WcfQuickStart.ServerApp\Spring.WcfQuickStart.ServerApp.2008.csproj", "{27AAD98C-4281-4DD4-9E20-1371C58C5283}" + ProjectSection(WebsiteProperties) = preProject + Debug.AspNetCompiler.Debug = "True" + Release.AspNetCompiler.Debug = "False" + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Aop.2005", "..\..\..\src\Spring\Spring.Aop\Spring.Aop.2005.csproj", "{3A3A4E65-45A6-4B20-B460-0BEDC302C02C}" + ProjectSection(WebsiteProperties) = preProject + Debug.AspNetCompiler.Debug = "True" + Release.AspNetCompiler.Debug = "False" + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|.NET = Debug|.NET + Debug|Any CPU = Debug|Any CPU + Debug|Mixed Platforms = Debug|Mixed Platforms + Release|.NET = Release|.NET + Release|Any CPU = Release|Any CPU + Release|Mixed Platforms = Release|Mixed Platforms + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D58B3101-4433-49C5-B41B-51134424FC42}.Debug|.NET.ActiveCfg = Debug|Any CPU + {D58B3101-4433-49C5-B41B-51134424FC42}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D58B3101-4433-49C5-B41B-51134424FC42}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D58B3101-4433-49C5-B41B-51134424FC42}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {D58B3101-4433-49C5-B41B-51134424FC42}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {D58B3101-4433-49C5-B41B-51134424FC42}.Release|.NET.ActiveCfg = Release|Any CPU + {D58B3101-4433-49C5-B41B-51134424FC42}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D58B3101-4433-49C5-B41B-51134424FC42}.Release|Any CPU.Build.0 = Release|Any CPU + {D58B3101-4433-49C5-B41B-51134424FC42}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {D58B3101-4433-49C5-B41B-51134424FC42}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {B71CEEE1-9C92-4C79-94BE-46D6D4CDE95A}.Debug|.NET.ActiveCfg = Debug|.NET + {B71CEEE1-9C92-4C79-94BE-46D6D4CDE95A}.Debug|.NET.Build.0 = Debug|.NET + {B71CEEE1-9C92-4C79-94BE-46D6D4CDE95A}.Debug|Any CPU.ActiveCfg = Debug|.NET + {B71CEEE1-9C92-4C79-94BE-46D6D4CDE95A}.Debug|Mixed Platforms.ActiveCfg = Debug|.NET + {B71CEEE1-9C92-4C79-94BE-46D6D4CDE95A}.Debug|Mixed Platforms.Build.0 = Debug|.NET + {B71CEEE1-9C92-4C79-94BE-46D6D4CDE95A}.Release|.NET.ActiveCfg = Debug|.NET + {B71CEEE1-9C92-4C79-94BE-46D6D4CDE95A}.Release|.NET.Build.0 = Debug|.NET + {B71CEEE1-9C92-4C79-94BE-46D6D4CDE95A}.Release|Any CPU.ActiveCfg = Debug|.NET + {B71CEEE1-9C92-4C79-94BE-46D6D4CDE95A}.Release|Mixed Platforms.ActiveCfg = Debug|.NET + {B71CEEE1-9C92-4C79-94BE-46D6D4CDE95A}.Release|Mixed Platforms.Build.0 = Debug|.NET + {710961A3-0DF4-49E4-A26E-F5B9C044AC84}.Debug|.NET.ActiveCfg = Debug|Any CPU + {710961A3-0DF4-49E4-A26E-F5B9C044AC84}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {710961A3-0DF4-49E4-A26E-F5B9C044AC84}.Debug|Any CPU.Build.0 = Debug|Any CPU + {710961A3-0DF4-49E4-A26E-F5B9C044AC84}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {710961A3-0DF4-49E4-A26E-F5B9C044AC84}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {710961A3-0DF4-49E4-A26E-F5B9C044AC84}.Release|.NET.ActiveCfg = Release|Any CPU + {710961A3-0DF4-49E4-A26E-F5B9C044AC84}.Release|Any CPU.ActiveCfg = Release|Any CPU + {710961A3-0DF4-49E4-A26E-F5B9C044AC84}.Release|Any CPU.Build.0 = Release|Any CPU + {710961A3-0DF4-49E4-A26E-F5B9C044AC84}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {710961A3-0DF4-49E4-A26E-F5B9C044AC84}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}.Debug|.NET.ActiveCfg = Debug|Any CPU + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}.Release|.NET.ActiveCfg = Release|Any CPU + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}.Release|Any CPU.Build.0 = Release|Any CPU + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {27AAD98C-4281-4DD4-9E20-1371C58C5283}.Debug|.NET.ActiveCfg = Debug|Any CPU + {27AAD98C-4281-4DD4-9E20-1371C58C5283}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {27AAD98C-4281-4DD4-9E20-1371C58C5283}.Debug|Any CPU.Build.0 = Debug|Any CPU + {27AAD98C-4281-4DD4-9E20-1371C58C5283}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {27AAD98C-4281-4DD4-9E20-1371C58C5283}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {27AAD98C-4281-4DD4-9E20-1371C58C5283}.Release|.NET.ActiveCfg = Release|Any CPU + {27AAD98C-4281-4DD4-9E20-1371C58C5283}.Release|Any CPU.ActiveCfg = Release|Any CPU + {27AAD98C-4281-4DD4-9E20-1371C58C5283}.Release|Any CPU.Build.0 = Release|Any CPU + {27AAD98C-4281-4DD4-9E20-1371C58C5283}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {27AAD98C-4281-4DD4-9E20-1371C58C5283}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {3A3A4E65-45A6-4B20-B460-0BEDC302C02C}.Debug|.NET.ActiveCfg = Debug|Any CPU + {3A3A4E65-45A6-4B20-B460-0BEDC302C02C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3A3A4E65-45A6-4B20-B460-0BEDC302C02C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3A3A4E65-45A6-4B20-B460-0BEDC302C02C}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {3A3A4E65-45A6-4B20-B460-0BEDC302C02C}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {3A3A4E65-45A6-4B20-B460-0BEDC302C02C}.Release|.NET.ActiveCfg = Release|Any CPU + {3A3A4E65-45A6-4B20-B460-0BEDC302C02C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3A3A4E65-45A6-4B20-B460-0BEDC302C02C}.Release|Any CPU.Build.0 = Release|Any CPU + {3A3A4E65-45A6-4B20-B460-0BEDC302C02C}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {3A3A4E65-45A6-4B20-B460-0BEDC302C02C}.Release|Mixed Platforms.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/examples/Spring/Spring.WcfQuickStart/src/Spring.WcfQuickStart.ClientApp/App.config b/examples/Spring/Spring.WcfQuickStart/src/Spring.WcfQuickStart.ClientApp/App.config new file mode 100644 index 00000000..56611f5f --- /dev/null +++ b/examples/Spring/Spring.WcfQuickStart/src/Spring.WcfQuickStart.ClientApp/App.config @@ -0,0 +1,57 @@ + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/examples/Spring/Spring.WcfQuickStart/src/Spring.WcfQuickStart.ClientApp/Config/ServerApp.xml b/examples/Spring/Spring.WcfQuickStart/src/Spring.WcfQuickStart.ClientApp/Config/ServerApp.xml new file mode 100644 index 00000000..67d620d4 --- /dev/null +++ b/examples/Spring/Spring.WcfQuickStart/src/Spring.WcfQuickStart.ClientApp/Config/ServerApp.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/examples/Spring/Spring.WcfQuickStart/src/Spring.WcfQuickStart.ClientApp/Config/Web.xml b/examples/Spring/Spring.WcfQuickStart/src/Spring.WcfQuickStart.ClientApp/Config/Web.xml new file mode 100644 index 00000000..280c52fe --- /dev/null +++ b/examples/Spring/Spring.WcfQuickStart/src/Spring.WcfQuickStart.ClientApp/Config/Web.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/examples/Spring/Spring.WcfQuickStart/src/Spring.WcfQuickStart.ClientApp/ICalculator.cs b/examples/Spring/Spring.WcfQuickStart/src/Spring.WcfQuickStart.ClientApp/ICalculator.cs new file mode 100644 index 00000000..f2909aa0 --- /dev/null +++ b/examples/Spring/Spring.WcfQuickStart/src/Spring.WcfQuickStart.ClientApp/ICalculator.cs @@ -0,0 +1,20 @@ +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(); + } +} diff --git a/examples/Spring/Spring.WcfQuickStart/src/Spring.WcfQuickStart.ClientApp/Program.cs b/examples/Spring/Spring.WcfQuickStart/src/Spring.WcfQuickStart.ClientApp/Program.cs new file mode 100644 index 00000000..88aa59da --- /dev/null +++ b/examples/Spring/Spring.WcfQuickStart/src/Spring.WcfQuickStart.ClientApp/Program.cs @@ -0,0 +1,78 @@ +#region License + +/* + * Copyright © 2002-2007 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#endregion + +#region Imports + +using System; + +using Spring.Context; +using Spring.Context.Support; + +using Spring.WcfQuickStart; + +#endregion + +namespace Spring.WcfQuickStart.ClientApp +{ + class Program + { + [STAThread] + static void Main() + { + try + { + Pause(); + + IApplicationContext ctx = ContextRegistry.GetContext(); + foreach (ICalculator calculator in ctx.GetObjectsOfType(typeof(ICalculator)).Values) + { + try + { + Console.WriteLine(calculator.GetName()); + Console.WriteLine("Add(1, 1) : " + calculator.Add(1, 1)); + 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(); + } + catch (Exception e) + { + Console.WriteLine(e); + Console.WriteLine(); + } + } + } + catch (Exception e) + { + Console.WriteLine(e); + } + finally + { + Pause(); + } + } + + public static void Pause() + { + Console.Write("--- Press to continue ---"); + Console.ReadLine(); + } + } +} \ No newline at end of file diff --git a/examples/Spring/Spring.WcfQuickStart/src/Spring.WcfQuickStart.ClientApp/Properties/AssemblyInfo.cs b/examples/Spring/Spring.WcfQuickStart/src/Spring.WcfQuickStart.ClientApp/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..187a4354 --- /dev/null +++ b/examples/Spring/Spring.WcfQuickStart/src/Spring.WcfQuickStart.ClientApp/Properties/AssemblyInfo.cs @@ -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.ClientApp")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Spring.WcfQuickStart.ClientApp")] +[assembly: AssemblyCopyright("Copyright © 2007")] +[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("7e54828a-b567-496d-98fa-c1e83019b699")] + +// 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")] diff --git a/examples/Spring/Spring.WcfQuickStart/src/Spring.WcfQuickStart.ClientApp/Spring.WcfQuickStart.ClientApp.2008.csproj b/examples/Spring/Spring.WcfQuickStart/src/Spring.WcfQuickStart.ClientApp/Spring.WcfQuickStart.ClientApp.2008.csproj new file mode 100644 index 00000000..b4ad84b0 --- /dev/null +++ b/examples/Spring/Spring.WcfQuickStart/src/Spring.WcfQuickStart.ClientApp/Spring.WcfQuickStart.ClientApp.2008.csproj @@ -0,0 +1,66 @@ + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {D58B3101-4433-49C5-B41B-51134424FC42} + Exe + Properties + Spring.WcfQuickStart + Spring.WcfQuickStart.ClientApp + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + {710961A3-0DF4-49E4-A26E-F5B9C044AC84} + Spring.Core.2005 + + + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Spring.Services.2008 + + + + + + + + + + + + \ No newline at end of file diff --git a/examples/Spring/Spring.WcfQuickStart/src/Spring.WcfQuickStart.ServerApp/App.config b/examples/Spring/Spring.WcfQuickStart/src/Spring.WcfQuickStart.ServerApp/App.config new file mode 100644 index 00000000..212cb362 --- /dev/null +++ b/examples/Spring/Spring.WcfQuickStart/src/Spring.WcfQuickStart.ServerApp/App.config @@ -0,0 +1,103 @@ + + + + + + + +
+ + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/examples/Spring/Spring.WcfQuickStart/src/Spring.WcfQuickStart.ServerApp/CalculatorService.cs b/examples/Spring/Spring.WcfQuickStart/src/Spring.WcfQuickStart.ServerApp/CalculatorService.cs new file mode 100644 index 00000000..a4ab946b --- /dev/null +++ b/examples/Spring/Spring.WcfQuickStart/src/Spring.WcfQuickStart.ServerApp/CalculatorService.cs @@ -0,0 +1,51 @@ +using System; +using System.Threading; + +namespace Spring.WcfQuickStart +{ + public class CalculatorService : 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 string GetName() + { + Thread.Sleep(sleepInSeconds * 1000); + return "ServerApp Calculator"; + } + } +} \ No newline at end of file diff --git a/examples/Spring/Spring.WcfQuickStart/src/Spring.WcfQuickStart.ServerApp/ICalculator.cs b/examples/Spring/Spring.WcfQuickStart/src/Spring.WcfQuickStart.ServerApp/ICalculator.cs new file mode 100644 index 00000000..f2909aa0 --- /dev/null +++ b/examples/Spring/Spring.WcfQuickStart/src/Spring.WcfQuickStart.ServerApp/ICalculator.cs @@ -0,0 +1,20 @@ +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(); + } +} diff --git a/examples/Spring/Spring.WcfQuickStart/src/Spring.WcfQuickStart.ServerApp/Program.cs b/examples/Spring/Spring.WcfQuickStart/src/Spring.WcfQuickStart.ServerApp/Program.cs new file mode 100644 index 00000000..9a828c24 --- /dev/null +++ b/examples/Spring/Spring.WcfQuickStart/src/Spring.WcfQuickStart.ServerApp/Program.cs @@ -0,0 +1,63 @@ +#region License + +/* + * Copyright © 2002-2007 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#endregion + +#region Imports + +using System; + +using Spring.Context.Support; +using Spring.ServiceModel; + +#endregion + +namespace Spring.WcfQuickStart +{ + class Program + { + [STAThread] + static void Main() + { + try + { + // Using Spring's IoC container + ContextRegistry.GetContext(); // Force Spring to load configuration + Console.Out.WriteLine("Server listening..."); + Console.Out.WriteLine("--- Press to quit ---"); + Console.ReadLine(); + + // Programmatically (You need to comment 'ServiceExporter' object definition in App.config) + //using (ServiceHost serviceHost = new ServiceHost("calculator")) + //{ + // serviceHost.Open(); + + // Console.Out.WriteLine("Server listening..."); + // Console.Out.WriteLine("--- Press to quit ---"); + // Console.ReadLine(); + //} + } + catch (Exception e) + { + Console.Out.WriteLine(e); + Console.Out.WriteLine("--- Press to quit ---"); + Console.ReadLine(); + } + } + } +} diff --git a/examples/Spring/Spring.WcfQuickStart/src/Spring.WcfQuickStart.ServerApp/Properties/AssemblyInfo.cs b/examples/Spring/Spring.WcfQuickStart/src/Spring.WcfQuickStart.ServerApp/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..3d39597a --- /dev/null +++ b/examples/Spring/Spring.WcfQuickStart/src/Spring.WcfQuickStart.ServerApp/Properties/AssemblyInfo.cs @@ -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.ServerApp")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Spring.WcfQuickStart.ServerApp")] +[assembly: AssemblyCopyright("Copyright © 2007")] +[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-1d14cf79c975")] + +// 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")] diff --git a/examples/Spring/Spring.WcfQuickStart/src/Spring.WcfQuickStart.ServerApp/SimplePerformanceInterceptor.cs b/examples/Spring/Spring.WcfQuickStart/src/Spring.WcfQuickStart.ServerApp/SimplePerformanceInterceptor.cs new file mode 100644 index 00000000..09415498 --- /dev/null +++ b/examples/Spring/Spring.WcfQuickStart/src/Spring.WcfQuickStart.ServerApp/SimplePerformanceInterceptor.cs @@ -0,0 +1,45 @@ +using System; +using System.Reflection; +using AopAlliance.Intercept; +using Common.Logging; + +namespace Spring.WcfQuickStart +{ + public class SimplePerformanceInterceptor : IMethodInterceptor + { + #region Logging Definition + + private readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + #endregion + + 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; + log.Info(Prefix + " " + time); + } + } + + #endregion + } +} diff --git a/examples/Spring/Spring.WcfQuickStart/src/Spring.WcfQuickStart.ServerApp/Spring.WcfQuickStart.ServerApp.2008.csproj b/examples/Spring/Spring.WcfQuickStart/src/Spring.WcfQuickStart.ServerApp/Spring.WcfQuickStart.ServerApp.2008.csproj new file mode 100644 index 00000000..2024cf4c --- /dev/null +++ b/examples/Spring/Spring.WcfQuickStart/src/Spring.WcfQuickStart.ServerApp/Spring.WcfQuickStart.ServerApp.2008.csproj @@ -0,0 +1,72 @@ + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {27AAD98C-4281-4DD4-9E20-1371C58C5283} + Exe + Properties + Spring.WcfQuickStart + Spring.WcfQuickStart.ServerApp + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + False + ..\..\..\..\..\lib\Net\2.0\Common.Logging.dll + + + + + + + + + + + + + + + + {3A3A4E65-45A6-4B20-B460-0BEDC302C02C} + Spring.Aop.2005 + + + {710961A3-0DF4-49E4-A26E-F5B9C044AC84} + Spring.Core.2005 + + + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Spring.Services.2008 + + + + + + + + \ No newline at end of file diff --git a/examples/Spring/Spring.WcfQuickStart/src/Spring.WcfQuickStart.Web.2008/App_Code/CalculatorService.cs b/examples/Spring/Spring.WcfQuickStart/src/Spring.WcfQuickStart.Web.2008/App_Code/CalculatorService.cs new file mode 100644 index 00000000..49a8051b --- /dev/null +++ b/examples/Spring/Spring.WcfQuickStart/src/Spring.WcfQuickStart.Web.2008/App_Code/CalculatorService.cs @@ -0,0 +1,29 @@ +using System; + +public class CalculatorService : ICalculator +{ + public double Add(double n1, double n2) + { + return n1 + n2; + } + + public double Subtract(double n1, double n2) + { + return n1 - n2; + } + + public double Multiply(double n1, double n2) + { + return n1 * n2; + } + + public double Divide(double n1, double n2) + { + return n1 / n2; + } + + public string GetName() + { + return "Web Calculator"; + } +} \ No newline at end of file diff --git a/examples/Spring/Spring.WcfQuickStart/src/Spring.WcfQuickStart.Web.2008/App_Code/ICalculator.cs b/examples/Spring/Spring.WcfQuickStart/src/Spring.WcfQuickStart.Web.2008/App_Code/ICalculator.cs new file mode 100644 index 00000000..7e789a9f --- /dev/null +++ b/examples/Spring/Spring.WcfQuickStart/src/Spring.WcfQuickStart.Web.2008/App_Code/ICalculator.cs @@ -0,0 +1,17 @@ +using System; +using System.ServiceModel; + +[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(); +} diff --git a/examples/Spring/Spring.WcfQuickStart/src/Spring.WcfQuickStart.Web.2008/Calculator.svc b/examples/Spring/Spring.WcfQuickStart/src/Spring.WcfQuickStart.Web.2008/Calculator.svc new file mode 100644 index 00000000..648abc09 --- /dev/null +++ b/examples/Spring/Spring.WcfQuickStart/src/Spring.WcfQuickStart.Web.2008/Calculator.svc @@ -0,0 +1 @@ +<%@ ServiceHost Language="C#" Debug="true" Service="calculator" Factory="Spring.ServiceModel.Activation.ServiceHostFactory" %> diff --git a/examples/Spring/Spring.WcfQuickStart/src/Spring.WcfQuickStart.Web.2008/Web.config b/examples/Spring/Spring.WcfQuickStart/src/Spring.WcfQuickStart.Web.2008/Web.config new file mode 100644 index 00000000..42b01e0e --- /dev/null +++ b/examples/Spring/Spring.WcfQuickStart/src/Spring.WcfQuickStart.Web.2008/Web.config @@ -0,0 +1,106 @@ + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +