Reputation: 1480
I am using the fsharp wsdl type provider to generate client side classes to consume wcf services. However, I am not able to reuse the same data contracts between different services that on the server side use the same data contracts.
I read some material discussing this for C# wcf projects using the svcutil, but how can this be accomplished while using the wsdl type provider mechanism?
This is an example of my problem:
So the following data object cannot be shared (as it is) by two different services like:
[<DataContract>]
type QuantityUnit () =
[<DataMember>] member val Quantity = 0. with get, set
[<DataMember>] member val Unit = "" with get, set
And this data object is used by:
[<ServiceContract>]
type IQuantityUnitService =
inherit IDataProviderServiceContract
[<OperationContract>]
abstract member NewQuantityUnit: quantity: float * unit: string -> QuantityUnit
And
[<ServiceContract>]
type ICalculationService =
inherit IDataProviderServiceContract
[<OperationContract>]
abstract member CalculateQuantityUnit: quantity: QuantityUnit -> QuantityUnit
But the generated class QuantityUnit for both services, has to generated for each service and cannot be passed from one service to the next service.
Upvotes: 1
Views: 298
Reputation: 1480
Given the fact that this question received no response and that in the meantime I couldn't come up with a workaround, I think it is save to assume that in fact, reuse of types between Wcf services implemented in Fsharp is not possible. Therefore, and for other reasons I switched to ServiceStack. An investment most worthwhile. It is much simpler, faster and reuse is a non issue as you can directly reference and reuse your data contracts.
Upvotes: 1