[Mono-list] Is ServiceKnownType attribute completed (WCF)?

mauzik mauzik at centrum.cz
Tue Sep 10 12:05:42 UTC 2013


HI all,

I have implemented service class which is called via WCF. If I run it under
.NET it works without any problems. Under Mono is situation bad for me. If I
run code, exception is thrown:

Contracts.Authentication.PinAuthenticationCommand' is unexpected. The type
should either be registered as a known type, or DataContractResolver should
be used. 

My Service contract is:

    [ServiceContract]
    [ServiceKnownType("GetKnownTypes",
typeof(AuthenticationProviderKnownTypes))]
    public interface IAuthenticationProvider
    {
        [OperationContract]
        AuthenticationStatus Process(IAuthenticationCommand command,
Terminal terminal);
    }

Class with KnownTypeResolver:

  public static class AuthenticationProviderKnownTypes
    {
        public static IEnumerable<Type>
GetKnownTypes(ICustomAttributeProvider provider)
        {
          // find out all child BaseAuthenticationCommand class
            return
Assembly.GetAssembly(typeof(IAuthenticationCommand)).GetExportedTypes()
                .Where(t =>
t.IsSubclassOf(typeof(BaseAuthenticationCommand))).ToArray();
        }
    }


Do any of you know if ServiceKnownType  is implemented and uses in WCF call? 
Thank you.



--
View this message in context: http://mono.1490590.n4.nabble.com/Is-ServiceKnownType-attribute-completed-WCF-tp4660832.html
Sent from the Mono - General mailing list archive at Nabble.com.


More information about the Mono-list mailing list