tags:

views:

17

answers:

1

Hi,

I'm working on a project wherein each time a new client comes in, a new database is created for that specific client. In setting up the datasource, it is normally done this way:

<?xml version="1.0" encoding="utf-8"?>

<objects xmlns="http://www.springframework.net"
xmlns:db="http://www.springframework.net/database"&gt;

<db:provider id="globalDBProvider"
provider="SqlServer-1.1"
connectionString="Server=myServer;Database=myGloba lDB;Uid=user1;Pwd=user1"/>

<object id="globalAdoTemplate" type="Spring.Data.Generic.AdoTemplate, Spring.Data">
<property name="DbProvider" ref="globalDBProvider"/>
</object>

That works fine for my "master" database since I know the database name. However, for my "new" databases. I was wondering if anyone has ideas on how to plugin the connectionString dynamically? E.g. suppose a user logs in and clicks on Client1 information. The Client1 information is stored in its own database.

I assume that I'd need to have another dbprovider for the client. But how to set it up such that it'll plugin the database and credentials at runtime?

A: 

Have you taken a look at implementing one of the other IDbProvider implementations that come with Spring.NET?

Have a look at the documentation here.

Eric
Figured this out some time ago. Thanks though!
Mylene