Geeks With Blogs
Welcome to
Geeks with Blogs
Login
Michael Freidgeim
Personal Website / Bio
587 Posts
| 965 Comments
My Other Recent Posts
Batch file that required administrative privileges.
PowerShell function to delete if exist and create empty folder
Pocket on IPad: Ability to rename articles is still missing
Read CSV files with multiple lines
Tiny MCE editor in ASP.Net Web Form
Methods to verify, are DataTables or DataSets the same.
2 options to write tests for WCF Services
Angular JS vs Knockout JS -quotes and links
POSTSHARP error PS0052: The plug-in "PostSharp.Patterns.Diagnostics.Weaver" was not found
Misleading compiler error "is a 'type' but is used like a 'variable'"
News
My Blog has been MOVED to
https://mfreidge.wordpress.com
Post Categories
SharePoint
Windows Mobile
Misc
SQL Server 2005
Office 2007 (O12)
News
AJAX
Visual Studio 2005
Mobile Networks
Technology
Games
Humour
Microsoft
Office
Google
Windows Vista
Ricky Gervais
MOSS
Visual Studio 2008 (Orcas)
Game Development
XPS
MacBook
Mac
Apple
PocketPC
PPC
Culture
Art
Thailand
PDC08
OCS
RoundTable
Hyper-V
Virtualization
Windows Server 2008
Red Dog
Zurich
Windows Cloud
Cloud OS
Live Platform
Cloud Services
Windows Strata
Augmented Reality
Multi-touch
Multitouch
.Net
ReMix
UK
US
Event
Azure
Windows Azure
.NET Services
PDC
PDC2008
TechEd
EMEA
GPS
SatNav
Funny
PIM
Outlook
Sony Ericsson
Ask A Ninja
DDD
Ninja
Bacon
IIS
IIS7.5
Win7
Windows 7
Rewrite
Unit Test
Web
ASP.NET
ASPNET
XPM
XPMode
Microsoft Surface
3G
HTC
Omnia
SharePoint 2010
Winter Games
iphone4
Kinect
Win8
ipad
ipad2
Windows 8
Iphone
Voip
Lync
WP7
Windows8
eBook
Android
Archives
April 2016 (1)
February 2016 (9)
January 2016 (5)
August 2013 (6)
July 2013 (1)
June 2013 (5)
May 2013 (3)
March 2013 (3)
February 2013 (5)
December 2012 (4)
November 2012 (1)
October 2012 (4)
September 2012 (4)
August 2012 (3)
July 2012 (3)
June 2012 (4)
May 2012 (3)
April 2012 (11)
March 2012 (4)
January 2012 (3)
December 2011 (2)
November 2011 (1)
October 2011 (1)
September 2011 (8)
August 2011 (1)
July 2011 (4)
June 2011 (16)
May 2011 (11)
July 2010 (4)
June 2010 (8)
May 2010 (3)
March 2010 (1)
December 2009 (1)
November 2009 (3)
September 2009 (3)
August 2009 (1)
July 2009 (5)
June 2009 (5)
May 2009 (7)
April 2009 (2)
March 2009 (5)
February 2009 (5)
January 2009 (10)
December 2008 (8)
November 2008 (7)
October 2008 (5)
September 2008 (3)
August 2008 (4)
July 2008 (15)
June 2008 (4)
May 2008 (12)
April 2008 (6)
March 2008 (6)
February 2008 (14)
January 2008 (11)
December 2007 (2)
November 2007 (3)
October 2007 (18)
September 2007 (7)
August 2007 (2)
July 2007 (6)
June 2007 (9)
May 2007 (10)
April 2007 (2)
March 2007 (19)
February 2007 (5)
January 2007 (3)
December 2006 (6)
November 2006 (6)
October 2006 (7)
September 2006 (10)
August 2006 (17)
July 2006 (9)
June 2006 (6)
May 2006 (9)
April 2006 (7)
March 2006 (21)
February 2006 (22)
January 2006 (11)
December 2005 (5)
November 2005 (5)
October 2005 (8)
September 2005 (5)
August 2005 (4)
July 2005 (2)
Michael Freidgeim's OLD Blog
My Blog has been MOVED to
https://mfreidge.wordpress.com
<< ResolveUrl() from WCF service
|
Home
|
Compare Pocket and Instapaper on IPad (again) >>
Using interfaces in DataContracts for WCF service versioning.
Comments
|
Share
We are implementing WCF Service versioning after having problems with enums in response (
Do not expose enum in WCF response
)
I found that we need rigorously follow the recommendations "Versioning When Schema Validation Is Not Required" from msdn article:
Best Practices: Data Contract Versioning
Initially I've ignored the recommendation "Do not attempt to version data contracts by type inheritance" and failed to generate backward compatible XML.
Reading the documentation I've noticed in
Service Versioning
article
an example
public interface IPurchaseOrderV2
{
DateTime OrderDate { get; set; }
}
which includes only one new field. It is used in
[DataContract(
Name = "PurchaseOrder ",
Namespace = "http://examples.microsoft.com/WCF/2006/02/PurchaseOrder")]
public class PurchaseOrderV2 : IPurchaseOrderV1, IPurchaseOrderV2
{
[DataMember(...)]
public DateTime OrderId {...}
[DataMember(...)]
public string CustomerId {...}
[DataMember(...)]
public DateTime OrderDate { ... }
}
I believe that it would it be more appropriate to have IPurchaseOrderV2 derived from IPurchaseOrderV1.
public interface IPurchaseOrderV2: PurchaseOrderV1
{
DateTime OrderDate { get; set; }
}
I asked myself, should I repeat all properties from original in a new interface and would it give any benefits to versioning.
public interface IPurchaseOrderV2
{
public DateTime OrderId { get; set; }
public string CustomerId { get; set; }
public DateTime OrderDate { get; set; }
}
but I was on a wrong track.
Interface is not allowed to be marked as DataContract.The reason is explained in
the answer
of
http://stackoverflow.com/questions/4720730/wcf-and-interfaces-on-data-contracts
XML schema doesn't know anything about interfaces - it's all about concrete, actual types.
Using interfaces for service contracts are recommended, however interfaces in dataContracts are not exposed externally.
i've checked
the article
again and found that the
appendix in MSDN
actually is quite clear:
write INTERNAL implementation code in terms of the interfaces rather than the data contract classes that implement the interfaces.
I just confused myself by quick browsing instead of proper reading.
Posted on Saturday, August 11, 2012 3:12 PM
Web Services/WCF
|
Back to top
Related Posts on Geeks With Blogs
Matching Categories
Serialization error when property is declared as b...
Web Services/WCF
Response for REST method was truncated because def...
Web Services/WCF
WCF Transactions are not supported by Azure.
Web Services/WCF
maxItemsInObjectGraph limit required to be changed...
Web Services/WCF
ResolveUrl() from WCF service
Web Services/WCF
Comments on this post: Using interfaces in DataContracts for WCF service versioning.
No comments posted yet.
Your comment:
Title:
Name:
Email: (never displayed)
(will show your
gravatar
)
Comment:
Allowed tags: blockquote, a, strong, em, p, u, strike, super, sub, code
Verification:
Copyright © Michael Freidgeim | Powered by:
GeeksWithBlogs.net
Popular Posts on Geeks with Blogs
0
Code Monkey Projectiles - Index
Geeks With Blogs Content Categories
ASP.Net
SQL Server
Apple
Google
SharePoint
Windows
Visual Studio
Team Foundation Server
Agile
Office
Design Patterns
Web
Azure
Brand New Posts on Geeks with Blogs
0
How do you run multiple instances of Microsoft Teams?
Need Something to Do over the Break? How About 25 Free JavaScript Courses?
Benefits of Apple Cider Vinegar
Shaking down the Raspberry Pi 400
Blog is Moving