Showing posts with label Entity Framework. Show all posts
Showing posts with label Entity Framework. Show all posts

Thursday, February 11, 2016

MySQL Data Source not appearing in Visual Studio 2015 - A complete solution

Hi All,

I was trying to upgrade my solution in VS 2015 Community Edition to use latest MySQL .NET connector with VS integration tools.

After i upgraded my provider to version 6.9.8. I was not able to see MySQL provider as a data source when i run Reverse Engineer Code First tool for EF to refresh my classes with my latest DB changes.

First, If you can't see entity framework when you right click on your project. Make sure that you have installed EF Power tools for VS 2015. Here is the link to download it since Microsoft has not officially released VS 2015 release of this tool.

**Entity Framework Power tools for Visual Studio 2015: download link

Once you install this tool, You should be able to view entity framework option with Reverse Engineer Code first option on your project.


Second thing, you have to see MySql data source so you can connect to MySql db and refresh your classes. below screen shot shows MySql data source.


To be able to to see MySQL data source as shown above, you need two components to be able to connect to MySQL db from VS 2015:

1) MySQL Connector/Net
2) MySQL for Visual Studio

You can get them both by installing MySQL installer that allow you to installer any MySQL components into your machine.



Tip: After installing these two components, you need to close and re-open your VS 2015 to get to see the new loaded MySQL data source.

Enjoy!

Friday, April 25, 2014

Unable to retrieve metadata for unrecognized element 'providers' when adding a controller in VS 2013

Hi,

I was trying to add a new controller in my project using Visual Studio 2013. I was using Code First Entity Framework for my data access. I tried to build and clean the project few times before adding the new controller; but still was getting this error message when  adding a new controller to my web api project.

Here is the error message:


The solution is the following:
1) Open the web.config file in your project.
2) Scroll down until you see entity framework section.
3) This is how it will be looking:

<entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="v11.0" />
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
  </entityFramework>

4) Remove the providers section.
5) Save and you will be able to add new controllers!

Hope this helps!