This is a migrated thread and some comments may be shown as answers.

Cross-database (or multiple database) relations

1 Answer 75 Views
Databases and Data Types
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Cuneyt
Top achievements
Rank 1
Cuneyt asked on 23 Dec 2011, 12:36 PM
Hi. I am new at ORM also web design. and i want to ask something about cross-database relations. 

i am going to use mvc3, sqlserver2008express, openaccess ORM to build new trail very small social web site to learn. i will use sqlmembership provider for membership. and there will be another database for site applications (user input,vs) like sitedb.

Sitedb.user table include extra information about user like adress,choicies(username:user.identity.name), etc and relations about other siteDB tables(like post).

the question is, how can be managed these databases relations (aspnetDB.user&siteDB.user) with openaccess ORM. how can i manage relations these different databases tables (aspnetDB.user&siteDB.user).

if cross-database relations is possible, i think there is two alternative. 

a)if  i start with model-first for sitedb, i have to create model and then database then define cross-database relation between these two databases(aspnetDB.user&siteDB.user) relations, and then i have to use database-first approach(reverse) again to update site models.

b)if i start with  database-first approach, i have to define database and define cross-database relation between these two databases and
i have to use database-first approach(reverse) to create site models.

if there is another approach for this situation without cross-database relations what is it.

c)for example : sitedb.user table has own primery key independent from aspnetDB.user table and has uniquie constraint to username value taken from user.identity.name and all site application relate with siteDB.user.

this alternatives is just my thinking and i dont know these approach is true. what would you suggest at this situation.

this was a bit long message, excuse me.

thank you very much.

1 Answer, 1 is accepted

Sort by
0
Serge
Telerik team
answered on 28 Dec 2011, 09:41 AM
Hello,

 When multiple databases are involved, handling relations between them becomes a bother. Telerik OpenAccess ORM (as well as any other ORM) can only handle classes that are mapped to tables in a single database. However there is a simple workaround, you can always implement a custom membership provider that utilizes OpenAccess, this way you can have a single database that handles both your users and application logic.

I hope this helps.

Greetings,
Serge
the Telerik team

Q3’11 of Telerik OpenAccess ORM is available for download. Register for the What's New in Data Tools webinar to see what's new and get a chance to WIN A FREE LICENSE!

Tags
Databases and Data Types
Asked by
Cuneyt
Top achievements
Rank 1
Answers by
Serge
Telerik team
Share this question
or