This article describes the use of three methods to implement or extend a common service protocol (Generic Service contract), which includes implementing a generic service agreement, extending a service agreement, and a long service (multi-headed services), which The common service agreement used is the Tutorial 8 (C #)-Generic service declaration. Created.
This instance is implemented by C # and can be found in the following directory:
Samples "Servicetutorials" TUTORIAL9 "CSharp
First step: Create a project
Since the project needs to extend a generic service agreement (Generic Service contract), you will need to refer to the DLL file generated by the service Tutorial 8 project in the project, and in the service Tutorial 9 project you'll see that it implements three services, To implement multiple services in a project, make sure that the namespaces for these services are different.
Step two: Implement a common service agreement
The first service instance is genericserviceimplementation, and the file that implements this service is GenericServiceImplementation.cs and GenericServiceImplementationTypes.cs, this service simply implements a generic service agreement.
Service type declaration (services type Declarations):
Because the Generic service protocol is used in this service, it does not require us to define his state and operations, which are already defined in the Generic service agreement and see ServiceTutorial8, but it still requires a protocol identifier (Contract identifier), Because this identity is needed to locate the service, the service identity is defined as follows:
1///<summary>
2///Generic Service implementation Contract Identifier
3///</summary>
4 Pub LIC sealed class Contract
5
6 {
7///the Unique Contract Identifier for this service
8
9 [DataMember ()]
Ten Public const String Identifier = "http://schemas.tempuri.org/2007/08/servicetutorial9/genericservice/ Implementation.html ";
One}
12