wcfdatacontracts

WCF client references to DataContracts ('Datasources' automatically generated)


I have a client that references two assemblies : a WCF service and DLL containing dataContracts.

At the same time, the client consumes the WSDL of the WCF Service. The problem is that the service reference does not proxy DataContracts (just the service methods). Instead it puts the DataContracts into 'Properties/DataSources/' folder. Each has an extension 'datasource' When opened i get an XML that looks like this :

<?XML version="1.0" encoding="utf-8"?>
<!--
    This file is automatically generated by Visual Studio .Net. It is 
    used to store generic object data source configuration information.  
    Renaming the file extension or editing the content of this file may   
    cause the file to be unrecognizable by the program.
-->
<GenericObjectDataSource DisplayName="DataContractClass" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
   <TypeInfo>MySolution.ContractClasses, MySolution, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
</GenericObjectDataSource>

Thanks in advance for your replies.


Solution

  • Ok I understand now, it seems to be a cool feature of WCF : instead of proxying the datacontracts it reuses (maps to) the dll containing the DataContracts.

    UPDATE : I've tried it on a bigger solution and it works like a charm, I just have one if DEBUG instead of plenty (namespaces):

    #if DEBUG
        static Service client = new Service();
    #else
        static ServiceClient client = new ServiceClient();
    #endif