in

CodePrairie .NET

South Dakota .NET User Group

chrisortman

WCF Lessons

Consider a datacontract like this:

[DataContract]
   public class CreateAccountRequest
   {
      private string _accountNumber;
      private string _accountGroupCode;
      private AccountProfile _profile;
      private Contact _billingContact;

      [DataMember]   
      public string AccountNumber
      {
         get { return _accountNumber; }
         set { _accountNumber = value; }
      }


      [DataMember(IsRequired=true)]
      public string AccountGroupCode
      {
         get { return _accountGroupCode; }
         set { _accountGroupCode = value; }
      }

When passing this as an argument from a WCF client to a WCF service I would expect an exception if i don't explicitly set the AccountGroupCode property. However this is not the behavior because the WCF client is smart enough to pass the element in the XML message...so it is really only to ensure a caller from some other library (ASMX, Java etc) supplys the element.

Published May 11 2007, 01:49 PM by chrisortman
Filed under: ,

Comments

No Comments

Leave a Comment

(required)
(optional)
(required)
Add
Powered by Community Server (Commercial Edition), by Telligent Systems