Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 11. The Service Layer > Mapping and Transformation

Mapping and Transformation

Now you are familiar with several modes of communication to bring data to the Silverlight client, and you’ve seen that certain approaches require more ceremony than others to make things work. Even though the current project uses WCF RIA Services to project the to-do list from the server to the client, the repository had to map the special class created for the services to the base model used by the rest of the application. Copying a to-do item is easy because there are only a few properties, but you can imagine how much work and complexity it will introduce in a larger project with hundreds of classes.

There are several ways to approach this and reduce the complexity significantly. One way is to use the actual classes generated by WCF RIA Services or exposed by the service proxy. WCF is flexible and can automatically generate property-change notifications or reuse existing types when you wire the service. This avoids the need to have to map between classes. In other cases, you either don’t want the overhead or side effects of dealing with the generated classes or must use a different model because of validation and data-formatting constraints. When that is the case, you have two key approaches you can use.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial