简体   繁体   中英

Cannot access ADO.NET Entity Data Model in MVC webAPI solution

My project consist of: MVC, WEB API solution.

I have generated an ADO.NET entity data model from my database schema and it resides in the app_code folder.

I tried to access the ADO.NET entiy data model from the models folder and the controllers folder and i cannot get access to it.

Should I have the ADO.NET entity data model in the App_Code folder?

How do we access the data model from the mvc application?

Typically it is as easy as MydatabaseNameModel db = new MydatabaseNameModel(); However, it is not visible this way.

Do i need to import something in the webAPI so the MydatabaseNameModel becomes implementable?

Check that you have a using statement that points to the namespace that the EDMX is using.

or

Add a new empty project, add the model to that project, then reference the project from the MVC site (also, don't forget the namespace)

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