Entities Template


The entities template generates the entity classes needed by LINQ. The classes are generated from a dbml file. You can modify the names for classes and properties by editing the dbml file. See DBML Template for a list of safe attributes to change in the dbml file.

The template will generate 2 files for every Type in the dbml file. One file will be the generated partial class that can not be changed as it is overwritten when the template is re-ran. It will have the following file name... <entity>.Generated.cs

The second file is a partial class that can be modified as it will not be re-generated. You can implement the partial methods in this file. Some partial method stubs are created by default. This file will be named... <entity>.cs

If you set the project file property on the template, the generated files will be added to the project. The file that can not be modified will be hidden under the file that can be changed.

Properties on the Entities.cst template:

Property

Description

1.Mapping

DbmlFile

The path to the dbml file used generate the entities from.

2.Class

AssociationNamingSuffix

Suffix for Many To Many Associations.

AuditingEnabled

Flag indicating if the default state of the AuditingEnabled property.

BaseDirectory

The folder to save the generated DataContext and base class files.

DefaultConnectionString

Default Connection String Name for DatabaseContext.

Framework

The version of the .Net Framework that is being used. Version 35_1 is necessary for dynamic data and data services attributes.

IncludeDataContract

Include serialization attributes on the generated entities. The attributes generated are based on the framework attribute above.

IncludeDataRules

Include CodeSmith.Data rules.

IncludeDataServices

Include Data Services attributes on the generated entities.

OutputDirectory

The folder to save the generated files.

ViewDirectory

The folder to save the generated view files.