08.01.2015 Views

Beginning Web Development, Silverlight, and ASP.NET AJAX

Beginning Web Development, Silverlight, and ASP.NET AJAX

Beginning Web Development, Silverlight, and ASP.NET AJAX

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPTER 7 ■ .<strong>NET</strong> 3.0: WINDOWS COMMUNICATION FOUNDATION 165<br />

}<br />

[DataMember]<br />

public string FirstName<br />

{<br />

get { return firstName;}<br />

set { firstName = value;}<br />

}<br />

[DataMember]<br />

public string LastName<br />

{<br />

get { return lastName;}<br />

set { lastName = value;}<br />

}<br />

Here you have a complex data type made up of two strings, each with a getter <strong>and</strong> a<br />

setter. You attribute the data class with the [DataContract] attribute, <strong>and</strong> each of its members<br />

with the [DataMember] attribute. You could of course have a larger class, with some<br />

data elements that you would want to keep private—in this case, you simply do not<br />

attribute them as DataMembers.<br />

When you execute your application <strong>and</strong> browse to the Service.svc file, you’ll see the<br />

service harness, as in Figure 7-4.<br />

Figure 7-4. Service harness

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!