Introduction
Since we are using WCF, we just have to write the contract of our service as an plain old interface decorated with some attributes. Nothing new here.
Some modules, however, need client and server code to be deployed, and require the service to implement some custom methods defined in an interface.
Accomplishing both things at the same time is as easy as defining our custom service interface as the union of all the needed interfaces (using interface implementation) and your own custom methods.
Example
Let's suppose we want to add a user interface to our
bug entities. We will need the server to implement the mandatory IBaseServer interfaces to enable
Entity Controls, and also IQueryServer interface to enable
Search. We won't need any login here, neither excel reports, so we won't implement INotesServer or IAlertsServer for instance.
We will need, however, some custom methods in the server that will be called by our client logic.
An interface like this will do the job:
[ServiceContract(SessionMode = SessionMode.Required)]
public interface IServerBugs : IBaseServer, IQueryServer
{
[OperationContract, NetDataContract]
IdentifiableEntity Save(IdentifiableEntity entidad);
}
Remember to decorate every custom operation with OperationContract, NetDataContract attributes.
In order for the client to know the interface (we don't use WSDL here) and the server to implement it, you need to place these interfaces in a shared assembly. The common thing is to place the Services in a folder inside the Entities assembly.
In previous version of the framework we recommended to place Contracts in a different assembly. Finally we have merged it for simplicity and they are merged with the entities.
Finally, you will need to: