LINQ to SQL Integrated Code Review

Define Custom DataContext Class

Code Review

Code Walkthrough

Define the DataContext class, which is used to connect to a database, retrieve objects from it, and submit changes back to it. The purpose of the DataContext is to translate requests for objects into SQL queries to be made against the database, and then to assemble objects out of the results.

public partial class PeopleDataContext : DataContext { public PeopleDataContext(String connString, XmlMappingSource xmlMap) : base(connString, xmlMap) { } }

The PeopleDataContext class inherits from the DataContext class. Create a class constructor that inherits from the base DataContext constructor, accepting a connection string and a XML mapping file as input parameters. The XML mapping file defines the relationship between the database data model and the application object model.