Mindscape
  • Register
  • Login
  • YOUR CART IS EMPTY
home
Software
  • Developers Toolbox
  • LightSpeed
  • Raygun
  • WPF Elements
  • Web Workbench
  • Metro Elements
  • Silverlight Elements
  • NHibernate Designer
  • Phone Elements
  • WPF Diagrams
  • Simple DB management
  • Visual Tools for SharePoint
Downloads
Store
  • Buy online
  • Purchase order
  • Volume discounts
  • Reseller
  • Software license
  • Contact sales
Blog
Support
About
  • About Us
  • Contact
  • Testimonials
rss
twitter
facebook
Basic Operations Working with Entities LightSpeed Configuration Basics Querying the Database Using LINQ Querying the Database Using Query Objects Creating Modifying and Deleting Entities Transactions

LightSpeed Configuration Basics

As described above, the LightSpeedContext object contains the configuration and connection settings for a particular database instance.  The usual way to store these settings is in the application configuration file – web.config for Web applications and sites, appname.exe.config for desktop applications – though you can also set them in code.  LightSpeedContext supports a lot of configuration options, which we describe more fully in the relevant sections of this user guide, and summarise in the Appendices.  In this section, we’ll describe the minimal configuration for connecting to a database.

LightSpeed Configuration Section

When you store settings in the application configuration file, you must declare and implement a lightSpeedContexts section, and define your specific settings within that section using the add element, as follows:

Declaring the lightSpeedContexts section

<configSections>
   <section name="lightSpeedContexts"
            type="Mindscape.LightSpeed.Configuration.LightSpeedConfigurationSection, Mindscape.LightSpeed" />
</configSections>

Implementing the lightSpeedContexts section

<lightSpeedContexts>
  <add name="Test" /> <!-- We will add more here shortly -->
</lightSpeedContexts>

Loading a LightSpeedContext from Configuration

To load a LightSpeedContext from configuration, pass the name of the configuration file entry to the LightSpeedContext constructor:

Loading a LightSpeedContext from configuration

private static readonly LightSpeedContext _context = new LightSpeedContext("Test");

Specifying the Data Provider

LightSpeed needs to know what kind of database you are using.  Specify this using the dataProvider attribute:

Specifying the data provider

<lightSpeedContexts>
  <add name="Test" dataProvider="SQLite3" />
</lightSpeedContexts>

The following values are recognised for dataProvider:

Provider Name

Description

SqlServer2000

Microsoft SQL Server 2000 using System.Data provider.

SqlServer2005

Microsoft SQL Server 2005 using System.Data provider.

SqlServer2008

Microsoft SQL Server 2008 using System.Data provider.

MySql5

MySQL 5 database using MySql.Data provider.

PostgreSql8

PostgreSQL 8 (or higher) 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.

VistaDB3

VistaDB 3 database through VistaDB.NET20 provider. This provider has been deprecated and is no longer officially supported.

VistaDB4

VistaDB 4 database through VistaDB.4 provider.

SqlServerCE

SQL Server Compact 3.5 through System.Data provider.

SqlServerCE4

SQL Server Compact 4 through System.Data provider (requires additional supporting assembly – see Working with Database Providers chapter).

DB2

DB2 9.5 through IBM.DB2 provider.

AmazonSimpleDB

Amazon SimpleDB cloud database or compatible.

The default provider is SqlServer2005 (Microsoft SQL Server 2005).

Specifying the Connection String

Connection strings are stored in the <connectionStrings> element as per the standard .NET configuration file schema.  When configuring LightSpeed you can refer to a connection string by name using the connectionStringName attribute:

Specifying the connection string

<lightSpeedContexts>
  <add name="Test" connectionStringName="Sample" />
</lightSpeedContexts>
<connectionStrings>
  <add name="Sample"
       connectionString="Data Source=sample.db3" />
</connectionStrings>

Other Configuration Options

Other common configuration options include:

·         pluralizeTableNames

·         identityMethod

·         quoteIdentifiers

See the chapter Controlling the Database Mapping for more information on these options.

Data Products

  • LightSpeed ORM
  • NHibernate Designer
  • SimpleDB Tools
  • SharePoint Tools

DevOp Tools

  • Raygun

Visual Controls

  • WPF Elements
  • WPF Diagrams
  • Silverlight Elements
  • Phone Elements

Popular Products

  • Web Workbench

    Modern web development for Visual Studio!

  • Mindscape Megapack

    All Mindscape products for one awesome price!

Quick Links

  • Forums
  • Blog
  • Register
  • Login
  • Contact us
  • Twitter
  • Facebook
  • Google+
  • YouTube
  • Linkedin
  • Rss

© Mindscape 2025. Mindscape is a registered trademark of Mindscape Limited.

  • Terms
  • Privacy