I have this scenario (abridged):
[ServiceContract]
public class TokenProviderService : ITokenProvider
{
private ITokenProvider TokenProvider { get; set; }
// BK - WCF doesn't like generic returns, so I've used an intermediary method.
public T GetTokenValue<T>(string tokenId)
{
throw new NotImplementedException();
}
[OperationContract]
public string GetTokenValueAsString(string tokenId)
{
return TokenProvider.GetTokenValueAsString(tokenId);
}
}
Where the only reason I implement the typed GetTokenValue
because of ITokenProvider
, a 'cast in stone' contract[1] interface used by both WCF and non-WCF clients. I have no wish to expose this as a service operation, and instead I use GetTokenValueAsString
, and deserialize the result in a client proxy, that also implements ITokenProvider
.
Yet despite having no OperationContract
attribute, GetTokenValue
causes the following error when I start the WCF project or try to add a service reference to this class:
Type 'T' cannot be exported as a schema type because it is an open generic type.
Is there any way I can tell WCF to ignore this method?
[1] Not a WCF contract, but a more general design contract.