Sharing DTO objects between WCF services

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

Now CountryService has the following method:

IList<CountryDTO> GetAllCountries();

In addition, FloristService has a method:

bool AddFlorist(FloristDTO florist);

So far so good, but the problem is that FloristDTO refers to CountryDTO ie

    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 good, but if I use the service proxy generator using Visual Stuidos (e.g. Add Reference> Add Service Reference), then I get two versions of CountryDTO created by ieFloristService.CountryDTO and CountryService.CountryDTO.

, . , "" , - , -, DTO?

,

+5
2

" " Reference.svcmap, NamespaceMappings.

svcutil /r (/reference) /n (/namespace).

0

All Articles