Entities template

The Entities.cst template generates the DataContext and entity classes that LINQ to SQL needs. It generates them from a dbml file, so to change the names of classes and properties, edit the dbml file. See the DBML template for the attributes you can safely change.

The template generates two files for every type in the dbml file:

File Description
<Entity>.Generated.cs The generated partial class. Don't change it: it's overwritten every time you run the template.
<Entity>.cs A partial class for your code. It's created once and never regenerated, so implement the partial methods here. The template creates some partial method stubs for you.

If you set the template's project file property, the generated files are added to the Visual Studio project, with each generated file nested under the file you edit.

Properties

Category Property Description
1. Mapping DbmlFile The path of the dbml file to generate the entities from.
2. Class AuditingEnabled The default value of the DataContext's AuditingEnabled property. See Auditing.
BaseDirectory The folder for the generated DataContext and base class files.
DefaultConnectionString The name of the default connection string for the DataContext.
Framework The .NET Framework version you generate for: v35, v35_SP1, v40 or v45. Dynamic Data and Data Services attributes need v35_SP1 or later.
IncludeDataContract Adds WCF DataContract serialization attributes to the entities. See Data Services and WCF.
IncludeDataRules Includes the CodeSmith.Data rules.
IncludeDataServices Adds Data Services attributes to the entities.
IncludeManyToMany Generates many-to-many associations.
IncludeXmlSerialization Includes XML serialization support.
InterfaceDirectory The folder for the generated interface files.
InterfaceNamespace The namespace of the generated interfaces. Leave it blank to skip generating them.
ModelDirectory The folder for the files generated for stored procedures.
OutputDirectory The folder for the generated entity files.
Misc AssociationNamingSuffix The suffix for many-to-many associations.