Entities Template

Entities Template

The entities template can generate multiple CSLA business objects at once. The business objects are generated from a Database. Please see the following tutorial for more information on the generated Business Objects. 

The Entities.cst template is located within the CSLA\CSharp\BusinessLayer or CSLA\Visual Basic\BusinessLayer folder.

You can control the names for classes and properties through various methods described here.

Template Properties

The CleanExpressions, IgnoreExpressions and IncludeExpressions properties use a list of Regular Expressions that match the full name of a Table, View, or Command.

Here is a common Regex pattern that will match a table by name (E.G., ^owner.TableName$). For Example, the following regex (^dbo.Account$) will match the Account table.

We recommend using Expresso to build your regular expression lists.

Property

Data Type

Description

1. DataSource

CleanExpressions

Regular Expression

List of Regular Expressions to use when cleaning property and class names.

IgnoreExpressions

Regular Expression

List of Regular Expressions that defines the schema objects to ignore.

IncludeExpressions

Regular Expression

List of Regular Expressions that defines the schema objects to include. This takes precedence over IgnoreExpressions.

IncludeAssociations

Boolean

Controls whether Entity associations are included in the generated output.

IncludeFunctions

Boolean

Controls whether Entities are generated from Stored Procedures.

IncludeViews

Boolean

Controls whether Entities are generated from Views.

SourceDatabase

DatabaseSchema

The Database that should be generated against.

2. Solution

FrameworkVersion

Enumeration

The .NET Framework version you wish to target. If the value is set to:

  • v35, then a Visual Studio solution that targets CSLA 3.8.x will be created.

  • v40, then a Visual Studio solution that targets CSLA 4.3.x will be created.

Location

String

The root directory of the generated solution.

SolutionName

String

The name of the Visual Studio solution that should be created.

3. Business Project

 

BusinessProjectName

String

The name of the business project directory and project.

IncludeSilverlightSupport

Boolean

Adds Silverlight features to the business project.

UseMemberVariables

Boolean

Uses private property backing fields for properties.

4. Data Project

AutoExecuteStoredProcedures

Boolean

Automatically executes the generated stored procedures against the selected SourceDatabase.

DataAccessImplementation

Enumeration

Changes how the Business Data Access Methods and Data Access Layer are implemented. Please use the following chart for a break down of usages.

Value

Location of Data Access

Data Access Implementation

Editable

None

Business Project

None, you can implement your own.

Yes

ParameterizedSQL

Business Project

Parameterized SQL

No

StoredProcedures

Business Project

Stored Procedures

No

LinqToSQL

Business Project

Linq To SQL (Only available for C#)

No

ObjectFactoryNone

Data Project

None, you can implement your own.

Yes

ObjectFactoryParameterizedSQL

Data Project

Parameterized SQL

No

ObjectFactoryStoredProcedures

Data Project

Stored Procedures

No

Please see this for more information on data access implementations.

DataProjectName

String

The name of the data project directory and project.

IsolationLevel

Enumeration

Isolation level to use in the generated stored procedures.

ParameterPrefix

String

Prefix to use for all generated stored procedure parameters.

ProcedurePrefix

String

Prefix to use for all generated stored procedures.

UseLazyloading

Boolean

Properties will load data only when it is requested.

5. Interface Project

InterfaceProjectName

Boolean

The name of the interface project directory and project.

6a. Entities (Please see this for more information)

CommandObject

TableSchemaCollection

A collection of tables that should be generated as Command Objects.

DynamicRoot

TableSchemaCollection

A collection of tables that should be generated as Dynamic Root Objects.

EditableChild

TableSchemaCollection

A collection of tables that should be generated as Editable Child Objects.

EditableRoot

TableSchemaCollection

A collection of tables that should be generated as Editable Root Objects.

ReadOnlyChild

TableSchemaCollection

A collection of tables that should be generated as Read Only Child Objects.

ReadOnlyRoot

TableSchemaCollection

A collection of tables that should be generated as Read Only Root Objects.

SwitchableObject

TableSchemaCollection

A collection of tables that should be generated as Switchable Objects.

6b. List Entities (Please see this for more information)

DynamicListBase

TableSchemaCollection

A collection of tables that should be generated as Dynamic List Base Objects.

DynamicRootList

TableSchemaCollection

A collection of tables that should be generated as Dynamic Root List Objects.

EditableChildList

TableSchemaCollection

A collection of tables that should be generated as Editable Child List Objects.

EditableRootList

TableSchemaCollection

A collection of tables that should be generated as Editable Root List Objects.

NameValueList

TableSchemaCollection

A collection of tables that should be generated as Name Value List Objects.

ReadOnlyChildList

TableSchemaCollection

A collection of tables that should be generated as Read Only Child List Objects.

ReadOnlyList

TableSchemaCollection

A collection of tables that should be generated as Read Only List Objects.

7. LinqToSQL Data Access Layer

 

LinqToSQLContextNamspace

String

The namespace of the generated PLINQO DataContext. Please see this for more information.

LinqToSQLDataContextName

String

The name of the generated PLINQO DataContext. Please see this for more information.