Mindscape LightSpeed - User Reference & API Documentation
Configuration

Framework configuration is managed by the LightSpeedContext top-level object or through a standard .NET configuration file.

Programmatic Configuration

To configure LightSpeed programatically, simply set the set the appropriate properties on LightSpeedContext.

CopyConfiguring LightSpeed in code
1LightSpeedContext.ConnectionString = "server=localhost; database=MyFirstProject; Integrated Security=SSPI;";
2LightSpeedContext.DataProvider = DataProvider.SqlServer2005;
3LightSpeedContext.IdentityMethod = IdentityMethod.IdentityColumn;

.NET XML Configuration File

An example of a standard file-based configuration is shown below.

CopyConfiguring through App.config
 1<?xml version="1.0" encoding="utf-8" ?>
 2
 3<configuration>
 4
 5  <configSections>
 6    <section name="LightSpeed" 
 7             type="Mindscape.LightSpeed.Configuration.LightSpeedConfigurationSection, Mindscape.LightSpeed" />
 8  </configSections>
 9
10  <LightSpeed connectionStringName="TestDatabase"
11              dataProvider="SQLite3"
12              identityMethod="KeyTable"
13              loggerClass="Mindscape.LightSpeed.Tests.CustomLogger, Mindscape.LightSpeed.Tests.Common"
14              cacheClass="Mindscape.LightSpeed.Caching.DefaultCache, Mindscape.LightSpeed"
15              pluralizeTableNames="true"
16              namingStrategyClass="Mindscape.LightSpeed.Tests.CustomNamingStrategy, Mindscape.LightSpeed.Tests.Common"/>
17
18  <connectionStrings>
19    <add name="TestDatabase"
20         connectionString="My Connection String" />
21  </connectionStrings>
22
23</configuration>

Configuration Settings

LightSpeed supports the following configuration options. These may be set programatically on LightSpeedContext or within a standard .NET configuration file (see Configuration).

Connection String (connectionString)

A standard ADO.NET connection string. This configuration attribute is required.

Data Provider (dataProvider)

The name of a LightSpeed supported data provider. Supported providers are list in the following table.

Provider Name Description
SqlServer2005 Microsoft SQL Server 2005 using System.Data provider.
MySql5 MySQL 5 database using MySql.Data provider.
PostgreSql8 PostgreSQL 8 database through Npgsql provider.
SQLite3 SQLite 3 database through System.Data.SQLite provider.
Oracle9 Oracle 9 (or higher) database through System.Data.OracleClient provider.
Oracle9Odp Oracle 9 (or higher) database through Oracle.DataAccess provider.

Identity Generation Method (identityMethod)

The method used to obtain new identity values (e.g. Guid)

Logger Class (loggerClass)

The name of a type implementing the Mindscape.LightSpeed.ILogger contract. See Logging.

Pluralization (pluralizeTableNames)

A boolean value indicating whether LightSpeed infers table names as plural.

Update Batch Size (updateBatchSize)

LightSpeed batches database updates to reduce network round-trips. This attribute determines the maximum number of DML statements per batch.

Identifier Quoting (quoteIdentifiers)

Whether identifiers are quoted in generated SQL.

Identify Block Size (identityBlockSize)

Determines the number of identity values generated per allocation. Applies to the IdentityMethod.KeyTable identity generation strategy.

Cache Class (cacheClass)

The full assembly qualified name of a type that implements the ICache interface. Use this to enable the second-level cache.

Naming Strategy Class (namingStrategyClass)

The full assembly qualified name of a type that implements the INamingStrategy interface. Use this extension point if you want to customize how LightSpeed resolves database names.

Detect Property Names (detectPropertyNames)

By default, LightSpeed automatically detects the property name to be used when an Entity raises a Entity.PropertyChanged event. Set this option to false to suppress automatic detection. If you set this option to false, and you use the LightSpeed Entity API to set properties, you must use Entity.Set and specify the property name in code, rather than using Entity.SetValue, as the latter requires automatic detection.