Convert multiple wcf services into a single service
<p>I need guidance before starting huge amount of work.</p>

<p>We have numerous wcf services (around 500) exposed on single iis. Currently these services use the same binding but have different and lengthy service contracts (we have around 15000 operation contracts!). My task is to set up a common processing pipeline that will apply to all services. That way we will have a hook to control these currently autonomous services. With these hook we will have  the opportunity to control transactional behavior, apply timeout and etc.</p>

<p>For this task, as the initial proposition, I am planning a code regeneration process that will map these existing services to a single service. Existing services (ex:</p>

<pre><code>[ServiceContract]
public interface IExecutionService
{
    [OperationContract]
    XXXResponse Do_XXX(XXXRequest req); 
    [OperationContract]
    YYYResponse Do_YYY(YYYRequest req);
    // ... ... ...
}
</code></pre>

<p>)
will be reduced to a single service with a single operation like:</p>

<pre><code>[ServiceContract]
public interface IExecutionService
{
    [OperationContract]
    ResponseBase Execute(RequestBase req);
}

[KnownType(typeof(XXXRequest))]
[KnownType(typeof(YYYRequest))]
// ... ... ...
public abstract class RequestBase
{
}
[KnownType(typeof(XXXResponse))]
[KnownType(typeof(YYYResponse))]
// ... ... ...
public abstract class ResponseBase
{
}
</code></pre>

<p>As the owner of this single service, I will face all the requests and then will proceed with regular execution. </p>

<p>Since each service request is independent of another, I am planning to use reflection to transmit information about the actual operation contract to be executed. More specifically, I am planning to put MethodInfo and ParameterInfos of the actual wcf service into the Request object. In my service, I will invoke the actual service using these reflection data. The return type of the actual operation contract, if it is not null, will be put into the ExecutionResult.</p>

<p>Do you see a flaw in this approach. As I said,  this is my initial proposal for the problem. Did anyone perform this kind of task before? Any help / ideas will highly be appreciated.</p>