This topic has not yet been rated - Rate this topic

How to: Make Entities Serializable

You can make entities serializable when you generate your code. Entity classes are decorated with the DataContractAttribute attribute, and columns with the DataMemberAttribute attribute.

Developers using Visual Studio can use the Object Relational Designer for this purpose. Object Relational Designer (O/R Designer)
Object Relational Designer (O/R Designer)

If you are using the SQLMetal command-line tool, use the /serialization option with the unidirectional argument. For more information, see Code Generation Tool (SQLMetal.exe).

Example

The following SQLMetal command lines produce files that have serializable entities.

sqlmetal /code:nwserializable.vb /language:vb "c:\northwnd.mdf" /sprocs /functions /pluralize /serialization:unidirectional
sqlmetal /code:nwserializable.cs /language:csharp "c:\northwnd.mdf" /sprocs /functions /pluralize /serialization:unidirectional

See Also

Concepts

Serialization

Other Resources

Creating the Object Model



Copyright © 2012 by Microsoft Corporation. All rights reserved.


Build Date:

2012-08-02
Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.