Cross-database (or multiple database) relations

2 posts, 0 answers
  1. Cuneyt
    Cuneyt avatar
    36 posts
    Member since:
    Dec 2011

    Posted 23 Dec 2011 Link to this post

    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.
  2. Serge
    Admin
    Serge avatar
    375 posts

    Posted 28 Dec 2011 Link to this post

    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!

  3. DevCraft banner
Back to Top