seagull
seagull

Reputation: 237

Entity Data Model get data from different databases

Would like to use Entity framwork 6 for a project. this project will have an Order entity data model, and get data from database a,b and c, all databases' schemes are same and have same stored procedure findorder. I've created Order model from database A stored procedure findorder, but i also need switch to database b and c depends on user input.

How to achieve this?

Upvotes: 1

Views: 56

Answers (1)

COLD TOLD
COLD TOLD

Reputation: 13579

The simplest way is to create several connection string to the database and then switch connection string while calling Context

YourContext db=YourContext("connectionname")

you will have to change the context class to have an extra overloading constructor that takes connection string.

Upvotes: 3

Related Questions