Search
Thursday, November 20, 2008 ..:: Blendblog.net ::.. Register  Login
 Bloggers Minimize

 Print   
 Sponsors Minimize

 Print   
 Users Online Minimize
Membership Membership:
Latest New User Latest: areel
New Today New Today: 0
New Yesterday New Yesterday: 0
User Count Overall: 15

People Online People Online:
Visitors Visitors: 0
Members Members: 0
Total Total: 0

Online Now Online Now:

 Print   
 Welcome to blendblog.net! Minimize

If you are a developer or designer who is creating cutting edge user interface experiences using Microsoft Expression Blend you've just found a great resource!  The purpose of this site is to share our experience with this brand new product.  As with any new piece of software there is a ton to discover.  Bugs will be revealed and workarounds discovered, hopefully this can be a resource to share in the discovery process!

While this site will focus largely on Expression Blend, it will also encompass WPF, Visual Studio, Silverlight, and other .net 3.5 technologies as they relate to the creation of great software.

Please login using your Microsoft LiveID or register a new account.  Doing so will let you comment on any of the blog entries on the site.  We look forward to helping you in your endeavors as well as you helping others in theirs!  We'd love to have more bloggers on our site...if you are interested please register and contact us!


 Print   
 WCF DataContract and Namespaces Minimize
Location: BlogsSean Cullinan    
Posted by: Sean Cullinan 8/5/2008 6:16 PM

Here's a quick heads up to anyone playing with WCF and having problems getting results they expect on the consumer of their services when using a custom class and the DataContext attribute.  I defined my custom class on both the server and consumer side (per basic MSFT examples) as:

<DataContract()> _
Public Class SequenceReturn
    <DataMember()> Public SomeString As String
End Class

However when the object would be received on my consumer side the SomeString value was always nothing.  What was going on?  After playing around I discovered that the problem had to do with the lack of namespace specification on the DataContract.  I believe that if the root namespace of both the service and consumer were the same then this declaration would work.  For me that is not the case.  Simply changing the declaration to:

<DataContract([Namespace]:="")> _
Public Class SequenceReturn
    <DataMember()> Public SomeString As String
End Class

On both ends fixed the problem.  Wasted 2 hours on this one, hope you don't have to do the same :)

Sean

Permalink |  Trackback

Comments (1)   Add Comment
Re: WCF DataContract and Namespaces    By Pete R on 10/1/2008 7:40 PM
Thanks to you (and Google), I saved 2 hours! :) Seriously, thanks very much for taking the time. All my stuff was coming back blank because I had a namespace on the ServiceContract and not on the DataContract. Once I set them both to the same, everything worked fine.


Your name:
Title:
Comment:
Add Comment   Cancel 

  
 Search Minimize

 Print   
 Archive Minimize

 Print   
 Blendblog Survey Minimize
Our next client application will be written using:




Submit Survey  View Results

 Print   
Copyright 2008 by blendblog.net   Terms Of Use  Privacy Statement
DotNetNuke® is copyright 2002-2008 by DotNetNuke Corporation