Print Page | Close Window

Create EntityManager while specifying target database

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=2959
Printed Date: 26-Apr-2025 at 10:22pm


Topic: Create EntityManager while specifying target database
Posted By: katit
Subject: Create EntityManager while specifying target database
Date Posted: 14-Sep-2011 at 11:21am
I'm working on SaaS application where each customer will have separate database. I store all database connection info in one central system database.
 
How do I "tell" EntityManager which connection string to use depending on parameter? In EF it's kind of easy, I just override constructor and build new Connection string.



Replies:
Posted By: katit
Date Posted: 14-Sep-2011 at 11:35am
I like it how you guys thought about everything. I found this example:
http://drc.ideablade.com/xwiki/bin/view/Documentation/code-sample-custom-datasourcekeyresolver - http://drc.ideablade.com/xwiki/bin/view/Documentation/code-sample-custom-datasourcekeyresolver
 
My question is.. Since I didn't find where it's referenced from. Do you use MEF to find interface? I'm little confused because this implementation just hangs in there and I don't see [Export] attribute on this custom class?

 

 



Posted By: DenisK
Date Posted: 15-Sep-2011 at 1:43pm
Hi katit;

Yes, that is correct. We use MEF to discover the IDataSourceKeyResolver interface as well as a bunch of others. Here's the list if you're interested.

http://drc.ideablade.com/xwiki/bin/view/Documentation/extend-customize - http://drc.ideablade.com/xwiki/bin/view/Documentation/extend-customize



Print Page | Close Window