简体   繁体   中英

Use Class From External Library As Model for MVC Controller Using Entity Framework

I'm following this tutorial to use the Code First database creation provided by EntityFramework. My hopes are to use this to create a website.

My issue comes when trying to create the controllers for the database context. I'm using a .dll to retrieve data from an API that I want to analyze and store in my own database. This dll has all the objects I may want in my db, so recreating these objects seems unnecessary. I want to treat these classes as my models instead of creating my own. However, I cannot point to the dll's classes when selecting the models in the Add Controller prompt.

Is it possible to do what I want? I have looked some for the answer to this question but my searches haven't been very fruitful.

Have you added the reference to your dll ?
Did you forgot "public" before your class ?

public class Foo{..}

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