Ripteq | Bespoke Enterprise Software Development
  • Home
  • Who We Are
    • Key People
    • Contact
    • Careers
  • What We Do
  • Blog
  • Client Area
    • GSI

Blog

EntitySpaces Multiple Database Connections

Jun 13

Written by:
Monday, June 13, 2011  RssIcon

 

EntitySpacesLogo

I often use EntitySpaces in projects and find that it works very well for multiple database connections. 

The guidance for using multiple connections is:

Register a connection as the ‘Default’

'Initialise EntitySpaces

        
            'Initialise Entity Spaces
            esProviderFactory.Factory = New EntitySpaces.Loader.esDataProviderFactory()

            Dim conn As New esConnectionElement
            'Manually register a connection 
            conn.ConnectionString = “…insert connection string …”
            conn.Name = "PrimaryDatabase"
            conn.Provider = "EntitySpaces.SqlClientProvider"
            conn.ProviderClass = "DataProvider"
            conn.SqlAccessType = esSqlAccessType.DynamicSQL
            conn.ProviderMetadataKey = "esDefault"
            conn.DatabaseVersion = "2005"

            esConfigSettings.ConnectionInfo.Connections.Add(conn)
            esConfigSettings.ConnectionInfo.Default = "PrimaryDatabase"

You can then add as many other connections, registering each with a unique name (only set one connection as the default).

To use a named connection, use the following syntax:

 

esUtility

esUtility u = new esUtility();
u.ConnectionName = "OptiQBackupDataBase";

Business Objects

// Single Entity
Employees emp = new Employees();
emp.es.Connection.Name = "OptiQBackupDataBase";

// Collection 
EmployeesCollection coll = new EmployeesCollection();
coll.es.Connection.Name = "OptiQBackupDataBase";

// Dynamic Query
EmployeesQuery query = new EmployeesQuery();
query.es2.Connection.Name = "OptiQBackupDataBase";

Trackback Print
Tags: EntitySpaces , Database
Categories: Code
Location: Blogs Parent Separator David Archer

0 comment(s) so far...



Your name:
Gravatar Preview
Your email:
(Optional) Email used only to show Gravatar.
Your website:
Title:
Comment:
Security Code
CAPTCHA image
Enter the code shown above in the box below
Add Comment   Cancel 

Search

Tags

Axosoft Backup Batch Files C# Code Generation Crashplan Data Template Database Databinding Deployment DropBox EntitySpaces Enum Reverse Parse Evernote Freshbooks Functions Google Apps Google Sync infographics LightSwitch Metadata nullable Queries saving null SecondCopy Source Control SQL SQL Express SQL Server SQL tables Subversion TFS Timespan Tools TSQL T-SQL types Upgrade VB.Net WCF Word WPF Xero XML

Categories

Skip Navigation Links.
Code (7)
Experience (2)

Recent Entries

Enum Reverse Parse
Thursday, April 26, 2012
Saving a NULL value
Tuesday, November 22, 2011
Dropping multiple tables and stored procedures in T-SQL
Tuesday, November 01, 2011
Infographics Love
Saturday, October 08, 2011
EntitySpaces Query Object
Wednesday, August 31, 2011
Infographics Love
Wednesday, July 13, 2011
Backing up SQL Express
Monday, July 04, 2011
Essential tools for modern information workers
Friday, June 17, 2011
Sample Portfolio
Monday, June 13, 2011
EntitySpaces Multiple Database Connections
Monday, June 13, 2011

Archive

Archive
<May 2012>
SunMonTueWedThuFriSat
293012345
6789101112
13141516171819
20212223242526
272829303112
3456789
Monthly
April, 2012 (1)
November, 2011 (2)
October, 2011 (1)
August, 2011 (1)
July, 2011 (2)
June, 2011 (16)

Go
Copyright 2011 by Ripteq
Register Login