Entity Framework – how to manage tables in different databases but on the same server?

I am using SQL Server 2008.

It seems as though in EF I need a different entity context for each database. Joining tables between databases means having to allow for this which is inconvenient and makes it more likely that I would simply put everything in one database.

  • How to bring Database Online in my online site
  • SQL Server 2005 db_denydatawriter example query
  • Complex SQL Update on 2 interdependent tables
  • Joining a table based on comma separated values
  • Using COALESCE in SQL view
  • Delete row from two sql tables that join together
  • Am I missing something? Surely EF can work better than this?

  • What is the best way to enforce a 'subset' relationship with integrity constraints
  • What's the difference between a Primary Key and Identity?
  • Sql Server using DateTime as Primary Key
  • Formatting Database Schema From SQL Server
  • “Prevent saving changes that require the table to be re-created” negative effects
  • SQL Server: how to constrain a table to contain a single row?
  • 2 Solutions collect form web for “Entity Framework – how to manage tables in different databases but on the same server?”

    You could map your entities to a view that returns joined tables, so your EF model doesn’t know about all this technical DB stuff.

    I don’t think it’s properly supported, but this guy has managed to get it to work.

    Basically, she set up Synonyms for the databases, and hacked the edmx file.

    MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.