WCF proxy code generation with IEntity

Posts   
 
    
Wessty
User
Posts: 3
Joined: 21-Jun-2007
# Posted on: 21-Jun-2007 19:42:34   

Hello,

I am working on creating a WCF service that will be returning IEntity types. To make this possible, for each OperationContract in the ServiceContract, one must use the ServiceKnownType attribute to identify all possible return types. For example:


        [OperationContract]
        [NetDataContract]
        [ServiceKnownType(typeof(AnnouncementEntity))]
        IEntity CreateNew(string type);

Please note that the NetDataContract atrribute is used to allow for an interface to be the return type of a method in WCF.

Now, this compiles and works fine but when I attempt to generate the metadata for the service using svcutil myDllFile.dll it causes an error when trying to validate the .xsd file. That error being:

Error: There was an error verifying some XML Schemas generated during The 'http://www.w3.org/2001/XMLSchema:schema' element is not declared.

I have found someone with a solution to this sort of problem, but I'm wondering if there is something that I am doing incorrectly in LLBLGen Pro. Please

Thanks.

Wessty
User
Posts: 3
Joined: 21-Jun-2007
# Posted on: 21-Jun-2007 20:00:39   

Also, I thought I would add this:

If you generate the proxy code using the wsdl file and the xsd file, the .cs file produced does not compile. I receive the following error:

The type or namespace name 'schema' could not be found (are you missing a using directive or an assembly reference?)

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39912
Joined: 17-Aug-2003
# Posted on: 21-Jun-2007 22:52:56   

You don't need the schema stuff anymore, that's for .net 2.0 webservices (as wsdl creates bad proxy classes otherwise)

Check this (bare bones) example: http://www.llblgen.com/tinyforum/GotoMessage.aspx?MessageID=49680&ThreadID=8927

Frans Bouma | Lead developer LLBLGen Pro
Wessty
User
Posts: 3
Joined: 21-Jun-2007
# Posted on: 22-Jun-2007 00:40:28   

That works perfectly! Thanks a lot!