Search code examples
c#asp.netrestasp.net-web-apimultiple-databases

asp.net Web Api and multiple database


I'm trying to create an API with asp net which uses multiple db. Basically, for example, I have an action to get all the employees (ex. api/employee) and I'd like to have "api/first_city/employee" which takes the data from the db associate to first_city and "api/second_city/employee" which takes the data from the second db. What is the best architecture? I can't find anything that can help me. Any suggestion? is it possible with asp net web api? Thanks


Solution

  • You will need to create sevral EntityFramework models for your site Open your project>>Add New Item >>Data>>ADO.NET Entity Data Model. So, each model will represent different database, then you can start coding using these models.

    enter image description here