简体   繁体   中英

How to use an ApplicationDbContext from another project in a ASP.NET web API project?

I'm trying to make a web API that connects to a server and substracts the information from a data base on that server.

I referenced the models from other project which connects to the same server and the same DB. But when I'm trying to scaffold a model class to get the controller I can't select my ApplicationDbContext who is already on my referenced models.

Illustrative image

I expected the ApplicationDbContext to be shown as an option of Data Context Class.

To get an easy solution I made a class where to make the connection and requests to the data base using OleDB class in another class.

If annyone knows how to do the same but better, I'll appreciate the help.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM