WCF Data Services / WCF Behaviors And Server Side Processing

ne of the concerns around the data services is their ability to control the outgoing data. Unfortunately, Entity Framework provider of WCF Data Services does not support processing data before forwarding to the clients. Many applications need such processing to cover different requirements such as logging the outgoing data, manipulating the default data before sending to the clients, hiding some special data from the clients, combining different data sources with the data of entity framework and etc.

Last month, I showed an approach that enables the developers to control the outgoing data of Data Services. That approach uses the customized version of LINQ to SQL to do so. In this paper, I will show an approach that can be applied to all types of Data Services even the ones that use the Entity Framework Provider. The new approach processes the outgoing data using the facilities provided by WCF Behaviors. The advantage of using WCF behaviors is the fact that they deploy in a plug & play manner and they don’t disturb the main developing code. The idea is attaching a behavior to the service host and listens to the outgoing data. The behavior raises an event whenever a WCF message has been sent to the clients. By capturing the event, the outgoing data can be read and even changed. Using the solution is simple and just needs two lines of code. First, you should change the default ServiceFactory of your service to use the AppServiceHostFactory...

read more


No Comments

Post Reply