Day: May 2, 2011

Not make changes to files generated by SharePoint command-line tool SPMetal

You should take care with the files generated by the SPMetal command. SPMetal is executed as a prebuild command in Visual Studio and the generated code is part of a solution that includes a new site type that is itself evolving during the development cycle. You should not make changes to these files, because SPMetal command overwrites the files it generates with each execution, for a given output path and against a given Web site.

If you need modify these files, you can add manually members to them in separate files, because the classes it generates are partial.

NOTE:

SPMetal is a command-line tool that generates entity classes that provides an object-oriented interface to the SharePoint Foundation content databases. These classes are primarily used in LINQ to SharePoint queries; but they are also used to add, delete, and change list items with concurrency conflict resolution. They too can be used as an alternative to the regular SharePoint Foundation object model for referencing content. The tool is located in %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\14\BIN.

See the Microsoft reference for to use SPMetal:
SPMetal
How to use
Overriding SPMetal Defaults by Using a Parameters XML File