La condivisione di tipi fra server e client e' sempre un argomento abbastanza critico.
Persino in Microsoft ci sono pareri decisamente contrastanti sulla consivisione di DataContract in WCF, come sottolinea il mio amico Josh:
Opinion was fairly divided with some thinking this is plain wrong and others thinking it is absolutely the right way to go provided you follow some basic principles to ensure that the "Share contract not class" tenet of SOA would be upheld.
I used to be a huge fan of sharing types between the client and the service in my ASMX coding days because the generated types were ugly and cumbersome to use (arrays instead of collections, incorrectly cased classes and members etc). However, this argument has lost some of its weight with the introducion of WCF and the svcutil.exe tool which allows you to specify the type to be used for collections and dictionaries.
Adesso con le nuove funzionalita' nella finestra AddService in Visual Studio 2008 si possono condividere tipi in maniera molto semplice.
Leggete tutto l'articolo qui:
Sharing types between the client and the server in WCF
Technorati tags:
WCF,
DataContract