Serialization in the ADO.NET Entity Framework
When you create Entity Data Models, entities are automatically decorated with Serializable
and DataContract
attributes and their members as DataMember
as you can easily check by investigating the code-behind file for EDMs. This enables binary and Xml serialization for entities also in WCF scenarios. To understand how this works, create a new console project and add a new EDM wrapping the Northwind database (see Chapter 27, “Introducing the ADO.NET Entity Framework,” for a review), including only the Customers
and Orders
tables. Basically you use formatters as you did in the objects serialization with no differences. Code in Listing 43.5 shows how to accomplish this.
Get Visual Basic® 2010 Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.