简体   繁体   中英

MySQL not Listed in Updated model from Database for entity framework in VS Express 2012 edition

i am trying to update model from database and use MySQL as my data source, it seems like there is some problem in listing MySQL as datasource . Please see the inline image : MySQL未在更新模型中列出 I have installed MySQL for visual studio , that way i am able to see the existing data model,created by someone else, but i can't update the data model. Also i tried the solution given here : Can't Create Entity Data Model - using MySql and EF6 , but it didn't worked out .

It seems like there is some problem with VS 2012 express edition.

I need to know is this an issue with VS 2012 express , or am I missing something,

How to list MySQL as the data source ?? Any help would be really appreciated.

AFAIK, VS 2012 Express doesn't supported by MySQL for Visual Studio as extension but supported by MySQL Connector/NET , according to this article :

MySQL for Visual Studio does not support Express versions of Microsoft development products, including the Visual Studio and the Microsoft Visual Web Developer.

To use MySQL Connector/Net with an Express versions of Microsoft development products, use MySQL Connector/Net 6.7.4 or later, without installing the MySQL for Visual Studio.

Here are some steps to use Connector/NET with EF:

  1. Install MySQL Connector/NET, add 3 following DLL files as reference in your project:

     MySql.Data.dll MySql.Data.Entity.dll (for EF6 it should be MySql.Data.Entity.EF6.dll) MySql.Web.dll 

The required files exist on MySQL\\MySQL Connector Net [version number]\\Assemblies\\[.NET version]\\ , eg C:\\Program Files\\MySQL\\MySQL Connector Net 6.xx\\Assemblies\\v4.5\\ .

  1. Change entityFramework element on your web.config file depending on EF version being used:

EF 5

<entityFramework>
    <defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.Entity" />
</entityFramework>

EF 6

<entityFramework codeConfigurationType="MySql.Data.Entity.MySqlEFConfiguration, MySql.Data.Entity.EF6">
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
    <providers>
      <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6" /> 
    </providers>
</entityFramework>
  1. Rebuild your project/solution and ensure "MySQL Database" option is available on data source dropdown list.

Update:

After conducting further research regarding data source availability, I found that Visual Studio Express editions have certain set of limitations regarding third party extensions, hence in some cases doesn't allow even creating connection to MySQL instance in EDM design-time (thanks to Devart reminds me about this). As a workaround, CLI-based EDM Generator may be used (see example and usage description ) like this example:

edmgen.exe /mode:fullgeneration /c:"[MySQL DB connection string]" /project:[project name] /entitycontainer:[entity name] /namespace:[table namespace] /language:CSharp

Related issues:

mySQL DataSource on Visual Studio 2012

Can't use a MySQL connection for entity framework 6

MySQL For Visual Studio 2012/2013

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