locked
whycontextclass and enitytable did not add in the modal folder when working with MySQL RRS feed

  • Question

  • User-91993069 posted

    I am working with asp.net MVC with MySQL

    first I create a table in MySQL-workbench and then I want to add that table in visual studio(2019) using ado.net entity model but the problem is not to add the table in the model folder

    Create a table in MySQL-workbench

    after adding the department table in a model folder using ado.net entity modal

    after clicking the next button then not add the enitytable in the model folder

    how to add the entity table in a modal folder using ado.net entity modal

    help

    Friday, August 14, 2020 11:42 AM

All replies

  • User1120430333 posted

    how to add the entity table in a modal folder using ado.net entity modal

    You have to right-click the Models folder in the Visual Stuido project and do an 'Add new Item'. The new item will be ADO.NET Entity Model that you will adding components needed into the Models folder like the Dbcontext and any entity class or classes into the Models folder.

    Friday, August 14, 2020 3:23 PM
  • User-91993069 posted

    Hello DA924

    I already try this right-click the Models folder in the Visual Studio project and do an 'Add New Item'. The new item will be ADO.NET Entity Model but I not see any entity classes and DB context in modal folder 

    Saturday, August 15, 2020 4:10 AM
  • User1120430333 posted

     I am using VS2019 with MS SQL Server Express 2016, and I created the EF components using the wizard in the Models folder for an existing database with no trouble.  You're using MySQL, I am not familiar with it and I can't tell why it's not doing it for MySQL.

    Saturday, August 15, 2020 5:50 PM
  • User1686398519 posted

    Hi rahulpas,

    1. You need to open the MySQL Application Configuration tool, and then configure the entity framework.
      • The MySQL Application Configuration tool appears as a small icon on the Solution Explorer toolbar in Visual Studio. The icon is visible only when a project is active (with a connection to MySQL), and Connector/NET is installed 
    2. To install MySQL for Visual Studio you need to make sure that MySQL Server, MySQL for Visual Studio and Connector/NET are installed.
    3. Remarks: How to configure and use the EF6 features that are implemented in Connector/NET:https://dev.mysql.com/doc/connector-net/en/connector-net-entityframework60.html
      • You need toinstall MySql.Data.Entity through NuGet.

    Best regards,

    YihuiSun

    Monday, August 17, 2020 7:25 AM
  • User-91993069 posted

    thanks for the explanation currently I am facing this error:

    what is that above error and also stop MySQL 

    what mistake did I make?

    Monday, August 17, 2020 9:42 AM
  • User1686398519 posted

    Hi rahulpas,

    You need to find your VS installation directory and open X:\XXXXXX\Microsoft Visual Studio\2019\Community\Common7\IDE\PrivateAssemblies, find the MySql.Data.dll file, then right-click the properties, and view "Details", You can see "Product version". If the version is 8.0.18, the installed mysql server version can only be up to 8.0.18,which can be lower.

    Note: You'd better first modify the version of mysql server, delete the configuration about mysql in web.config, and reinstall MySql.Data.Entity.

    Here is the result.

    Best Regards,

    YihuiSun

    Tuesday, August 18, 2020 7:33 AM
  • User-91993069 posted

    Hello Yihuisun

    see my version of Microsoft

    when I am trying to adding a class then showing below error message

    which place I am doing wrong?

    Tuesday, August 18, 2020 10:44 AM