views:

543

answers:

1

Hi,

i got the problem, that a WCF service ( generated with svcutil.exe ) generates it's own datatypes, instead of using the ones i already defined..

for example:

The svcutil generated something like this:

 public partial class EmailTransactionRequestMsg : object,   System.Runtime.Serialization.IExtensibleDataObject
{

    private System.Runtime.Serialization.ExtensionDataObject extensionDataField;

    private int bit_to_setField;

    private string country_db_identifierField;
.

.
}

when i actually want it to use the class already exists:

[DataContract(Namespace = "Ps.App.Mailing.MsgQueue.MsgInterfaces")]
public class EmailTransactionRequestMsg
{
    [DataMember]
    public string country_db_identifier;

    [DataMember]
    public int bit_to_set;

}

i see that the svcutil service creates a new extensionData-field ( which i don't know for which purpose this is required )

So, how do i get svcutil to use my own class ( because i don't want to cast the objects by every single field )

Thank you all!

+3  A: 

Please take a lookat the following svcutil reference:

http://msdn.microsoft.com/en-us/library/aa347733.aspx

especially the /reference: switch which should be exactly what you're looking for.

i see that the svcutil service creates a new extensionData-field ( which i don't know for which purpose this is required )

This is generated for you to help with data contract versioning. If you add a new property to EmailTransactionRequestMsg later but have a client that is using an older assembly without that property defined it will still be able to use the new service and ExtensionDataObject will contain unknown (new) property(ies). Again MSDN should sprovide you with more details: http://msdn.microsoft.com/en-us/library/system.runtime.serialization.extensiondataobject.aspx

Robert Wilczynski
Hi,thanks that was my first attempt too, but if i reference: /reference:<path to the service exe> there is still a new class generated in the client.Even if i derived the class from IExtensibleDataObject..
David
Oh, i see that the client isn't even generated if i add the reference..
David
Please add the svcutil invocation to your post. Also from the top of my head if you want to reuse data contracts put them all in separate assembly and reference that one in svc util.
Robert Wilczynski