Question

I feel this is a stupid question even before asking, but my brain isn't working too well right now. I have two WCF services "CountryService" and "FloristService".

Now CountryService has the following method:

IList<CountryDTO> GetAllCountries();

Additionally, FloristService has a method:

bool AddFlorist(FloristDTO florist);

All good so far, but the problem is that the FloristDTO references a CountryDTO i.e.

    public  string Address1 { get; set; }
    public  string Address2 { get; set; }
    public  string Address3 { get; set; }
    public  string City { get; set; }
    public  string Postcode { get; set; }
    public  CountryDTO Country { get; set; }
    public  string Name { get; set; }

This is fine, but if I use the service proxy generating util with Visual Stuidos (i.e. Add Reference > Add Service Reference) then I get two versions of CountryDTO are created i.e.FloristService.CountryDTO and CountryService.CountryDTO.

Now I can think of a few ways to overcome this, but nonw of them seem right. I wondered what the "correct" approach to this would be, is there anything funky I can do with the proxy generation tool to make it share common DTOs?

Cheers, Chris

OTHER TIPS

Article "How to reuse types across service endpoints" suggests on client side manually update Reference.svcmap to include multiple and NamespaceMappings.

Alternatively svcutil does allow you to specify multiple endpoints at a single time and utilize /r(/reference) and /n(/namespace) parameters.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top