Asp.net MVC adding new controller issue

im trying to make a mvc app and wanted to make a controller but it wants me to add a data context type i tried looking it up and it seems i need to use "ApplicationDbContext" from my Data folder but i dont have a data folder or ApplicationDbContext. I also tried to use the default context that it provided and that didnt work either.
6 Replies
Oops
Oops2y ago
Can you provide some more detailed info here? "It wants me to add a data context type" is pretty vague. Are you currently trying to access a db from your code, or did you copy some code that contains references to an ApplicationDbContext?
strawhatgoofy
strawhatgoofyOP2y ago
sorry, i went to the controller folder did add -> controller(i did mvc with views, using entity framework idk if that matters) -> then im at the "Add mvc controller with view using entity framework. when i click the plus sign on the "data context class" it has the "add data context" pop up. I looked it up and it looks like it needs the ApplicationDbContext from the data folder in the solution explorer but i dont have a data folder.
Oops
Oops2y ago
Oh, what's the error you get when you let it create GoalsWebAppContext? I've been on Mac/VSCode for a couple years now so I can't remember a lot of the Visual Studio gui behavior.
strawhatgoofy
strawhatgoofyOP2y ago
Oh. Well thats embarassing. it worked this time. i guess i spelled it wrong or something. The data folder is now showing too lmao
Oops
Oops2y ago
Awesome! Out of curiosity when you said Entity Framework did you mean Entity Framework Core? I'd recommend that over EF6 personally
strawhatgoofy
strawhatgoofyOP2y ago
i am not sure. it was the default one i will see if i can change it
Want results from more Discord servers?
Add your server