Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Missing DbModel.Context.cs file under DbModel.Context.tt

I'm new to ASP.NET and just managed to configure my machine to be able to Update my EFModel from a distant MySql database.

I had to install MySql Connector 6.9.8 and MySql for Visual Studio 1.2.7. Everything was working well and I was able to build my API without problems. So after installing MySql Connector 6.9.8 I followed these steps to get rid of the EntityFramework error.

Just after that I updated my model from my database and wanted to publish my project to check whether the newly created fields of my table were well linked, I got an error:

“The type or namespace 'UphairDbEntities' could not be found”

Since I didn't touch a thing in my API or WebApp project before, I checked on a backup of this project and I figured out I was missing the DbModel.context.cs in my EFModel under the file DbModel.Context.tt in my actual version. Why is it missing and how can I generate this file please ?

For the record, I'm using Entity Framework 6.2.0 and MySql.Data/MySql.Data.Entity NuGet packages 6.9.9.

Thanks in advance for you support :)

like image 570
Pierrick Martellière Avatar asked Mar 13 '26 11:03

Pierrick Martellière


1 Answers

Like stated here, I just had to delete all the files under the edmx (DbModel.Context.tt, DbModel.Designer.cs and DbModel.tt) and to update model from database with Entity Data Model Designer.

Now I understand how Entity works.

like image 193
Pierrick Martellière Avatar answered Mar 15 '26 01:03

Pierrick Martellière



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!