Hi,
If let's say we created a custom service, where one of the inputs to the service is postal address
[DataContractAttribute]
class PostalAddressContract
{
Description locationName;
LogisticsAddressStreet street;
LogisticsAddressCityName city;
LogisticsAddressCountyId county;
LogisticsAddressStateId state;
LogisticsAddressCountryRegionId countryRegionId;
LogisticsAddressZipCodeId postCode;
If let's say we created a custom service, where one of the inputs to the service is postal address
[DataContractAttribute]
class PostalAddressContract
{
Description locationName;
LogisticsAddressStreet street;
LogisticsAddressCityName city;
LogisticsAddressCountyId county;
LogisticsAddressStateId state;
LogisticsAddressCountryRegionId countryRegionId;
LogisticsAddressZipCodeId postCode;
}
And there was another service that needs to create postal addresses, but needs more fields in the postal address. Is it better to create a new contract for this service that extends the first contract and use it?
[DataContractAttribute]
class PostalAddressExtendedContract extends PostalAddressContract
{
StreetName streetName;
[DataContractAttribute]
class PostalAddressExtendedContract extends PostalAddressContract
{
StreetName streetName;
}
or do we just add the new fields to the original class? but if I add them to the original class, is it ok that the first service will start seeing fields that it's not going to use? i want to know if it's a best practice to only show the fields needed for the service or if it's better to add everything and it's up to them to use it or ignore it?

Report
All responses (
Answers (