Browse Source

Add basic (IIS) support for WCF services.

pull/15/merge
Eusebiu Marcu 14 years ago
parent
commit
7119d558e5
  1. 52
      data/templates/file/CSharp/CSharp.WcfService.xft
  2. 47
      data/templates/file/VB/VB.WcfService.xft
  3. 112
      data/templates/project/CSharp/CSharp.WcfServiceProject.xpt
  4. 104
      data/templates/project/VB/VB.WcfServiceProject.xpt
  5. 12
      src/Setup/Files.wxs
  6. 6
      src/Setup/Setup.wxs

52
data/templates/file/CSharp/CSharp.WcfService.xft

@ -0,0 +1,52 @@
<?xml version="1.0"?>
<Template
author="Eusebiu Marcu"
created="03/08/2011"
lastModified="03/08/2011"
version="1.0">
<Config
name="WCF Service"
icon="C#.File.NewClass"
category="C#"
subcategory="WCF"
defaultname="Service${Number}.svc"
language="C#"/>
<Description>WCF Service</Description>
<Files>
<File name="${FullName}">
<![CDATA[
<%@ServiceHost language="C#" Debug="true" Service="${StandardNamespace}.${ClassName}"%>
]]>
</File>
<File name="${FullName}.cs" language="C#" DependentUpon="${FullName}">
<![CDATA[${StandardHeader.C#}
using System;
using System.ServiceModel;
namespace ${StandardNamespace}
{
[ServiceContract]
public interface I${ClassName}
{
[OperationContract]
void MyOperation();
}
/// <summary>
/// Description of ${ClassName}.
/// </summary>
public class ${ClassName} : I${ClassName}
{
public void MyOperation()
{
// implement the operation
}
}
}
]]>
</File>
</Files>
</Template>

47
data/templates/file/VB/VB.WcfService.xft

@ -0,0 +1,47 @@
<?xml version="1.0"?>
<Template
author="Eusebiu Marcu"
created="03/08/2011"
lastModified="03/08/2011"
version="1.0">
<Config
name="WCF Service"
icon="VBNet.File.NewClass"
category="VB"
subcategory="WCF"
defaultname="Service${Number}.svc"
language="VBNET"/>
<Description>WCF Service</Description>
<Files>
<File name="${FullName}">
<![CDATA[
<%@ServiceHost language="VB" Debug="true" Service="${StandardNamespace}.${ClassName}"%>
]]>
</File>
<File name="${FullName}.vb" language="VBNET" DependentUpon="${FullName}">
<![CDATA[${StandardHeader.VBNET}
Imports System
Imports System.ServiceModel
<ServiceContract> _
Public Interface I${ClassName}
<OperationContract> _
Sub MyOperation()
End Interface
''' <summary>
''' Description of ${ClassName}.
''' </summary>
Public Class ${ClassName}
Implements I${ClassName}
Public Sub MyOperation() Implements I${ClassName}.MyOperation
' implement the operation
End Sub
End Class
]]>
</File>
</Files>
</Template>

112
data/templates/project/CSharp/CSharp.WcfServiceProject.xpt

@ -0,0 +1,112 @@
<?xml version="1.0"?>
<Template
author="Eusebiu Marcu"
created="03/08/2011"
lastModified="03/08/2011"
version="1.0">
<!-- Template Header -->
<TemplateConfiguration>
<Name>WCF Service</Name>
<Category>C#</Category>
<Subcategory>WCF</Subcategory>
<Icon>C#.Project.Form</Icon>
<Description>WCF Service</Description>
<SupportedTargetFrameworks>v3.0</SupportedTargetFrameworks>
</TemplateConfiguration>
<!-- Actions -->
<Actions>
<Open filename="ServiceCalculator.svc.cs"/>
</Actions>
<Project language="C#">
<ProjectItems>
<Reference Include="System" />
<Reference Include="System.ServiceModel" />
</ProjectItems>
<PropertyGroup escapeValue="False">
<OutputType>Library</OutputType>
<ProjectTypeGuids>{3D9AD99F-2412-4246-B90B-4EAA41C64699};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<AppDesignerFolder>Properties</AppDesignerFolder>
</PropertyGroup>
<PropertyGroup configuration="Debug">
<OutputPath>bin\</OutputPath>
</PropertyGroup>
<PropertyGroup configuration="Release">
<OutputPath>bin\</OutputPath>
</PropertyGroup>
<Files>
<File name="Properties\AssemblyInfo.cs" src="DefaultAssemblyInfo.cs" />
<File name="ServiceCalculator.svc">
<![CDATA[
<%@ServiceHost language="C#" Debug="true" Service="${StandardNamespace}.ServiceCalculator"%>
]]>
</File>
<File name="ServiceCalculator.svc.cs" DependentUpon="ServiceCalculator.svc">
<![CDATA[${StandardHeader.C#}
using System;
using System.ServiceModel;
namespace ${StandardNamespace}
{
[ServiceContract]
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);
}
public class ServiceCalculator : 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;
}
}
}
]]>
</File>
<File name="web.config">
<![CDATA[<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<services>
<!-- This section is optional with the default configuration model introduced in .NET Framework 4 -->
<service name="${StandardNamespace}.ServiceCalculator">
<!-- This endpoint is exposed at the base address provided by host: http://localhost/${ProjectName}/ServiceCalculator.svc -->
<endpoint address=""
binding="wsHttpBinding"
contract="${StandardNamespace}.ICalculator" />
</service>
</services>
</system.serviceModel>
</configuration>
]]>
</File>
</Files>
</Project>
</Template>

104
data/templates/project/VB/VB.WcfServiceProject.xpt

@ -0,0 +1,104 @@
<?xml version="1.0"?>
<Template
author="Eusebiu Marcu"
created="03/08/2011"
lastModified="03/08/2011"
version="1.0">
<!-- Template Header -->
<TemplateConfiguration>
<Name>WCF Service</Name>
<Category>VB</Category>
<Subcategory>WCF</Subcategory>
<Icon>VBNet.Project.Form</Icon>
<Description>WCF Service</Description>
<SupportedTargetFrameworks>v3.0</SupportedTargetFrameworks>
</TemplateConfiguration>
<!-- Actions -->
<Actions>
<Open filename="ServiceCalculator.svc.vb"/>
</Actions>
<Project language="VBNet">
<ProjectItems>
<Reference Include="System" />
<Reference Include="System.ServiceModel" />
</ProjectItems>
<PropertyGroup escapeValue="False">
<OutputType>Library</OutputType>
<ProjectTypeGuids>{3D9AD99F-2412-4246-B90B-4EAA41C64699};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<AppDesignerFolder>Properties</AppDesignerFolder>
</PropertyGroup>
<PropertyGroup configuration="Debug">
<OutputPath>bin\</OutputPath>
</PropertyGroup>
<PropertyGroup configuration="Release">
<OutputPath>bin\</OutputPath>
</PropertyGroup>
<Files>
<File name="Properties\AssemblyInfo.vb" src="DefaultAssemblyInfo.vb" />
<File name="ServiceCalculator.svc">
<![CDATA[
<%@ServiceHost language="VB" Debug="true" Service="${StandardNamespace}.ServiceCalculator"%>
]]>
</File>
<File name="ServiceCalculator.svc.vb" DependentUpon="ServiceCalculator.svc">
<![CDATA[${StandardHeader.VBNET}
Imports System
Imports System.ServiceModel
<ServiceContract> _
Public Interface ICalculator
<OperationContract> _
Function Add(n1 As Double, n2 As Double) As Double
<OperationContract> _
Function Subtract(n1 As Double, n2 As Double) As Double
<OperationContract> _
Function Multiply(n1 As Double, n2 As Double) As Double
<OperationContract> _
Function Divide(n1 As Double, n2 As Double) As Double
End Interface
Public Class ServiceCalculator
Implements ICalculator
Public Function Add(n1 As Double, n2 As Double) As Double Implements ICalculator.Add
Return n1 + n2
End Function
Public Function Subtract(n1 As Double, n2 As Double) As Double Implements ICalculator.Subtract
Return n1 - n2
End Function
Public Function Multiply(n1 As Double, n2 As Double) As Double Implements ICalculator.Multiply
Return n1 * n2
End Function
Public Function Divide(n1 As Double, n2 As Double) As Double Implements ICalculator.Divide
Return n1 / n2
End Function
End Class
]]>
</File>
<File name="web.config">
<![CDATA[<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<services>
<!-- This section is optional with the default configuration model introduced in .NET Framework 4 -->
<service name="${StandardNamespace}.ServiceCalculator">
<!-- This endpoint is exposed at the base address provided by host: http://localhost/${ProjectName}/ServiceCalculator.svc -->
<endpoint address=""
binding="wsHttpBinding"
contract="${StandardNamespace}.ICalculator" />
</service>
</services>
</system.serviceModel>
</configuration>
]]>
</File>
</Files>
</Project>
</Template>

12
src/Setup/Files.wxs

@ -730,6 +730,9 @@
<Component Id="CSharpMvcViewUserControlFileTemplate" Guid="FF8B0A8A-6C11-471E-AAAC-351D8D762973" DiskId="1"> <Component Id="CSharpMvcViewUserControlFileTemplate" Guid="FF8B0A8A-6C11-471E-AAAC-351D8D762973" DiskId="1">
<File Id="CSharp.Mvc.ViewUserControl.xft" Name="CSharp.Mvc.ViewUserControl.xft" Source="..\..\data\templates\file\CSharp\CSharp.Mvc.ViewUserControl.xft" KeyPath="yes" /> <File Id="CSharp.Mvc.ViewUserControl.xft" Name="CSharp.Mvc.ViewUserControl.xft" Source="..\..\data\templates\file\CSharp\CSharp.Mvc.ViewUserControl.xft" KeyPath="yes" />
</Component> </Component>
<Component Id="CSharpWcfServiceFileTemplate" Guid="FBCEE100-BE0D-11E0-A9F2-C7D14824019B" DiskId="1">
<File Id="CSharp.WcfService.xft" Name="CSharp.WcfService.xft" Source="..\..\data\templates\file\CSharp\CSharp.WcfService.xft" KeyPath="yes" />
</Component>
</Directory> </Directory>
<Directory Id="MiscFileTemplatesFolder" Name="Misc"> <Directory Id="MiscFileTemplatesFolder" Name="Misc">
<Component Guid="F47EE9EB-321F-4D98-A373-BFE2C2D801D0" Id="EmptyHTMLFileTemplate" DiskId="1"> <Component Guid="F47EE9EB-321F-4D98-A373-BFE2C2D801D0" Id="EmptyHTMLFileTemplate" DiskId="1">
@ -801,6 +804,9 @@
<Component Id="VBMvcViewUserControlFileTemplate" Guid="A6272501-2DB7-48B5-AF86-7D53016DF29A" DiskId="1"> <Component Id="VBMvcViewUserControlFileTemplate" Guid="A6272501-2DB7-48B5-AF86-7D53016DF29A" DiskId="1">
<File Id="VB.Mvc.ViewUserControl.xft" Name="VB.Mvc.ViewUserControl.xft" Source="..\..\data\templates\file\VB\VB.Mvc.ViewUserControl.xft" KeyPath="yes" /> <File Id="VB.Mvc.ViewUserControl.xft" Name="VB.Mvc.ViewUserControl.xft" Source="..\..\data\templates\file\VB\VB.Mvc.ViewUserControl.xft" KeyPath="yes" />
</Component> </Component>
<Component Id="VBWcfServiceFileTemplate" Guid="A1EABE3E-BE0D-11E0-A4E6-5BD14824019B" DiskId="1">
<File Id="VB.WcfService.xft" Name="VB.WcfService.xft" Source="..\..\data\templates\file\VB\VB.WcfService.xft" KeyPath="yes" />
</Component>
</Directory> </Directory>
</Directory> </Directory>
<Directory Id="ProjectTemplatesFolder" Name="project"> <Directory Id="ProjectTemplatesFolder" Name="project">
@ -842,6 +848,9 @@
<Component Id="EmptyCSharpMvcWebProjectTemplate" Guid="3EA7EF3D-F72A-446C-AA21-BA97EF9B321A" DiskId="1"> <Component Id="EmptyCSharpMvcWebProjectTemplate" Guid="3EA7EF3D-F72A-446C-AA21-BA97EF9B321A" DiskId="1">
<File Id="Empty.CSharp.MvcWebProject.xpt" Name="EmptyMvcWebProject.xpt" Source="..\..\data\templates\project\CSharp\EmptyMvcWebProject.xpt" KeyPath="yes" /> <File Id="Empty.CSharp.MvcWebProject.xpt" Name="EmptyMvcWebProject.xpt" Source="..\..\data\templates\project\CSharp\EmptyMvcWebProject.xpt" KeyPath="yes" />
</Component> </Component>
<Component Id="CSharpWcfServiceProjectTemplate" Guid="D793DD78-BE0C-11E0-AC34-34D04824019B" DiskId="1">
<File Id="CSharp.WcfServiceProject.xpt" Name="CSharp.WcfServiceProject.xpt" Source="..\..\data\templates\project\CSharp\CSharp.WcfServiceProject.xpt" KeyPath="yes" />
</Component>
</Directory> </Directory>
<Directory Id="MiscProjectTemplatesFolder" Name="Misc"> <Directory Id="MiscProjectTemplatesFolder" Name="Misc">
<Component Guid="F9A7F832-6EC8-4B15-A037-146BD028C9D5" Id="MiscProjectTemplates" DiskId="1"> <Component Guid="F9A7F832-6EC8-4B15-A037-146BD028C9D5" Id="MiscProjectTemplates" DiskId="1">
@ -880,6 +889,9 @@
<Component Id="EmptyVBMvcWebProjectTemplate" Guid="DCCCBDDE-6F8A-4163-8294-F84E5E76917C" DiskId="1"> <Component Id="EmptyVBMvcWebProjectTemplate" Guid="DCCCBDDE-6F8A-4163-8294-F84E5E76917C" DiskId="1">
<File Id="Empty.VB.MvcWebProject.xpt" Name="EmptyMvcWebProject.xpt" Source="..\..\data\templates\project\VB\EmptyMvcWebProject.xpt" KeyPath="yes" /> <File Id="Empty.VB.MvcWebProject.xpt" Name="EmptyMvcWebProject.xpt" Source="..\..\data\templates\project\VB\EmptyMvcWebProject.xpt" KeyPath="yes" />
</Component> </Component>
<Component Id="VBWcfServiceProjectTemplate" Guid="FF1C11DA-BE0C-11E0-A35E-6FD04824019B" DiskId="1">
<File Id="VB.WcfServiceProject.xpt" Name="VB.WcfServiceProject.xpt" Source="..\..\data\templates\project\VB\VB.WcfServiceProject.xpt" KeyPath="yes" />
</Component>
</Directory> </Directory>
<Component Guid="73EAC135-57B6-46C0-9F24-70A347B9AAC8" Id="ExampleProjectTemplate" DiskId="1"> <Component Guid="73EAC135-57B6-46C0-9F24-70A347B9AAC8" Id="ExampleProjectTemplate" DiskId="1">
<File Source="..\..\data\templates\project\ComplexExample.xpt.test" Id="ComplexExample.xpt.test" Name="ComplexExample.xpt.test" /> <File Source="..\..\data\templates\project\ComplexExample.xpt.test" Id="ComplexExample.xpt.test" Name="ComplexExample.xpt.test" />

6
src/Setup/Setup.wxs

@ -313,6 +313,12 @@
<ComponentRef Id="VBMvcViewContentPageFileTemplate"/> <ComponentRef Id="VBMvcViewContentPageFileTemplate"/>
<ComponentRef Id="VBMvcViewMasterPageFileTemplate"/> <ComponentRef Id="VBMvcViewMasterPageFileTemplate"/>
<ComponentRef Id="VBMvcViewUserControlFileTemplate"/> <ComponentRef Id="VBMvcViewUserControlFileTemplate"/>
<ComponentRef Id="CSharpWcfServiceProjectTemplate"/>
<ComponentRef Id="CSharpWcfServiceFileTemplate"/>
<ComponentRef Id="VBWcfServiceProjectTemplate"/>
<ComponentRef Id="VBWcfServiceFileTemplate"/>
<ComponentRef Id="EmptyHTMLFileTemplate"/> <ComponentRef Id="EmptyHTMLFileTemplate"/>
<ComponentRef Id="EmptyMsBuildFileTemplate"/> <ComponentRef Id="EmptyMsBuildFileTemplate"/>
<ComponentRef Id="EmptyResourceFileTemplate"/> <ComponentRef Id="EmptyResourceFileTemplate"/>

Loading…
Cancel
Save