Entities template
The Entities.cst template generates many CSLA business objects at once, from your database. To learn about the business objects it generates, see Inspecting the generated solution.
The template is in the CSharp\BusinessLayer folder of the CSLA templates for C#, and in the VisualBasic\BusinessLayer folder for Visual Basic.
Tip
You control the names of the generated classes and properties in several ways. See Renaming classes and properties.
Data access implementations
The DataAccessImplementation property sets how the business objects' data access methods and the data access layer are implemented:
| Value | Location of the data access code | Implementation | Editable |
|---|---|---|---|
None |
Business project | None; you implement your own. | Yes |
ParameterizedSQL |
Business project | Parameterized SQL | No |
StoredProcedures |
Business project | Stored procedures | No |
LinqToSQL |
Business project | LINQ to SQL (C# only) | No |
ObjectFactoryNone |
Data project | None; you implement your own. | Yes |
ObjectFactoryParameterizedSQL |
Data project | Parameterized SQL | No |
ObjectFactoryStoredProcedures |
Data project | Stored procedures | No |
Properties
Note
The CleanExpressions, IgnoreExpressions and IncludeExpressions properties take a list of regular expressions that match the full name of a table, view or command. For example, ^dbo.Account$ matches the Account table. Expresso is a useful tool for building regular expressions.
1. DataSource
| Property | Type | Description |
|---|---|---|
CleanExpressions |
Regular expressions | Text to remove from property and class names. |
IgnoreExpressions |
Regular expressions | The schema objects to ignore. |
IncludeExpressions |
Regular expressions | The schema objects to include. Takes precedence over IgnoreExpressions. |
IncludeAssociations |
Boolean | Includes entity associations in the generated code. |
IncludeFunctions |
Boolean | Generates entities from stored procedures. See Generating from views and stored procedures. |
IncludeViews |
Boolean | Generates entities from views. |
SourceDatabase |
DatabaseSchema | The database to generate from. |
2. Solution
| Property | Type | Description |
|---|---|---|
FrameworkVersion |
Enumeration | The .NET Framework version to target, which sets the CSLA version: v35 targets CSLA 3.8, v40 targets CSLA 4.3 and v45 targets CSLA 4.5. |
Location |
String | The root folder of the generated solution. |
SolutionName |
String | The name of the Visual Studio solution to create. |
3. Business Project
| Property | Type | Description |
|---|---|---|
BusinessProjectName |
String | The name of the business project and its folder. |
UseMemberVariables |
Boolean | Uses private backing fields for properties. |
4. Data Project
| Property | Type | Description |
|---|---|---|
AutoExecuteStoredProcedures |
Boolean | Runs the generated stored procedures against SourceDatabase. See Extending stored procedures. |
DataAccessImplementation |
Enumeration | How the data access methods and data access layer are implemented. See Data access implementations. |
DataProjectName |
String | The name of the data project and its folder. |
IsolationLevel |
Enumeration | The isolation level of the generated stored procedures. |
ParameterPrefix |
String | The prefix of every generated stored procedure parameter. |
ProcedurePrefix |
String | The prefix of every generated stored procedure. |
UseLazyLoading |
Boolean | Loads property data only when it's requested. |
5. Interface Project
| Property | Type | Description |
|---|---|---|
InterfaceProjectName |
String | The name of the interface project and its folder. |
6a. Entities
Each property is a collection of tables to generate as that CSLA object type.
| Property | Type | Description |
|---|---|---|
CommandObject |
TableSchemaCollection | Tables to generate as command objects. |
DynamicRoot |
TableSchemaCollection | Tables to generate as dynamic root objects. |
EditableChild |
TableSchemaCollection | Tables to generate as editable child objects. |
EditableRoot |
TableSchemaCollection | Tables to generate as editable root objects. |
ReadOnlyChild |
TableSchemaCollection | Tables to generate as read-only child objects. |
ReadOnlyRoot |
TableSchemaCollection | Tables to generate as read-only root objects. |
SwitchableObject |
TableSchemaCollection | Tables to generate as switchable objects. |
6b. List Entities
| Property | Type | Description |
|---|---|---|
DynamicListBase |
TableSchemaCollection | Tables to generate as dynamic list base objects. |
DynamicRootList |
TableSchemaCollection | Tables to generate as dynamic root list objects. |
EditableChildList |
TableSchemaCollection | Tables to generate as editable child list objects. |
EditableRootList |
TableSchemaCollection | Tables to generate as editable root list objects. |
NameValueList |
TableSchemaCollection | Tables to generate as name value list objects. |
ReadOnlyChildList |
TableSchemaCollection | Tables to generate as read-only child list objects. |
ReadOnlyList |
TableSchemaCollection | Tables to generate as read-only list objects. |
To change an object's type, see Configuring business object types.
7. LinqToSQL Data Access Layer
These properties apply when DataAccessImplementation is LinqToSQL, which uses a PLINQO data context.
| Property | Type | Description |
|---|---|---|
LinqToSQLContextNamespace |
String | The namespace of the generated PLINQO DataContext. |
LinqToSQLDataContextName |
String | The name of the generated PLINQO DataContext. |