Working with Data

Data is the "Holy Grail" of an application. Almost every application needs to operate on data—whether it's creating, consuming, or processing data. Without data, almost all applications would be useless. You can use many patterns when designing applications to work with data. In the early days of DNA and client-server applications, a favorite approach was the n-tier approach where the application was divided into n tiers (the most common division was three tiers). In the three-tier approach, the first tier is the presentation tier, which handles all the presentation of the application (the user interface) and is essentially what the user interacts with. The next tier is the business layer, which contains all the business rules to which the application needs to adhere. The last tier is the data layer, which performs all the create, read, update, and delete (CRUD)functionality. The data layer usually connects to the required back-end data sources using one of many well-known mechanisms such as OLE DB, ODBC, and so on.

In the SOA world, however, data is transferred in the form of a "message" over the wire. You can think of the WCF as a messaging infrastructure because it can receive, process, and dispatch messages. In addition, it can also construct messages and dispatch and deliver them to a desired location. Often, the messages are represented as objects in memory and need to be converted to an appropriate format so they can be transmitted across the wire. The process of converting them is called serialization and is explained in the "XML Serialization" section. Similarly, on the other end of the wire, the process of converting the message to an object that can be represented in memory is called deserialization. This chapter introduces the concepts of data contracts in addition to the basics of serialization.

After completing this chapter, you will have the following knowledge:

  • You'll know why you need serialization.

  • You'll understand the serialization options available in WCF.

  • You'll understand best practices for data connectivity.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset