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.

IgnoreExpressionsRegular ExpressionList of Regular Expressions that defines the schema objects to ignore.
IncludeExpressionsRegular ExpressionList of Regular Expressions that defines the schema objects to include. This takes precedence over IgnoreExpressions.
IncludeAssociationsBooleanControls whether Entity associations are included in the generated output.
IncludeFunctionsBooleanControls whether Entities are generated from Stored Procedures.
IncludeViewsBooleanControls whether Entities are generated from Views.
SourceDatabaseDatabaseSchemaThe Database that should be generated against.

2. Solution

FrameworkVersionEnumeration

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 
BusinessProjectNameStringThe name of the business project directory and project.
IncludeSilverlightSupportBooleanAdds Silverlight features to the business project.
UseMemberVariablesBooleanUses private property backing fields for properties.

4. Data Project

AutoExecuteStoredProceduresBooleanAutomatically executes the generated stored procedures against the selected SourceDatabase.
DataAccessImplementationEnumeration

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

ValueLocation of Data AccessData Access ImplementationEditable
NoneBusiness ProjectNone, you can implement your own.Yes
ParameterizedSQLBusiness ProjectParameterized SQLNo
StoredProceduresBusiness ProjectStored ProceduresNo
LinqToSQLBusiness ProjectLinq To SQL (Only available for C#)No
ObjectFactoryNoneData ProjectNone, you can implement your own.Yes
ObjectFactoryParameterizedSQLData ProjectParameterized SQLNo
ObjectFactoryStoredProceduresData ProjectStored ProceduresNo

Please see this for more information on data access implementations.

DataProjectName

String

The name of the data project directory and project.

IsolationLevelEnumerationIsolation level to use in the generated stored procedures.
ParameterPrefixStringPrefix to use for all generated stored procedure parameters.
ProcedurePrefixStringPrefix to use for all generated stored procedures.
UseLazyloadingBooleanProperties 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)
CommandObjectTableSchemaCollectionA collection of tables that should be generated as Command Objects.
DynamicRootTableSchemaCollectionA collection of tables that should be generated as Dynamic Root Objects.
EditableChildTableSchemaCollectionA collection of tables that should be generated as Editable Child Objects.
EditableRootTableSchemaCollectionA collection of tables that should be generated as Editable Root Objects.
ReadOnlyChildTableSchemaCollectionA collection of tables that should be generated as Read Only Child Objects.
ReadOnlyRootTableSchemaCollectionA collection of tables that should be generated as Read Only Root Objects.
SwitchableObjectTableSchemaCollectionA collection of tables that should be generated as Switchable Objects.
6b. List Entities (Please see this for more information)
DynamicListBaseTableSchemaCollectionA collection of tables that should be generated as Dynamic List Base Objects.
DynamicRootListTableSchemaCollectionA collection of tables that should be generated as Dynamic Root List Objects.
EditableChildListTableSchemaCollectionA collection of tables that should be generated as Editable Child List Objects.
EditableRootListTableSchemaCollectionA collection of tables that should be generated as Editable Root List Objects.
NameValueListTableSchemaCollectionA collection of tables that should be generated as Name Value List Objects.
ReadOnlyChildListTableSchemaCollectionA collection of tables that should be generated as Read Only Child List Objects.
ReadOnlyListTableSchemaCollectionA collection of tables that should be generated as Read Only List Objects.
7. LinqToSQL Data Access Layer 
LinqToSQLContextNamspaceStringThe namespace of the generated PLINQO DataContext. Please see this for more information.
LinqToSQLDataContextNameStringThe name of the generated PLINQO DataContext. Please see this for more information.