Random Dev Notes

December 15, 2013

Visual FoxPro Entity Framework Provider v2-Getting Started with Code First

Filed under: .Net Development — Tags: — Tom Brothers @ 4:31 pm

A new version of the Visual FoxPro Entity Framework Provider that targets EF6 is available.  The purpose of this blog post is to outline what you need to get started using Code First with the EF Power Tools Beta 4. 

Getting Started:

  • Install the VFP EF Provider Version 1.  The Version 1 build is required because the EF Power Tools doesn’t work with the new EF6 classes.
  • Install the VFPEntityFrameworkProvider2 NuGet package. 
  • Run the Reverse Engineer Code First command.
  • Change the data source to use the VFP Entity Framework Provider (EF4 & EF5) option.
  • A connection string is added to your config file as part of the code generation process.  The connection string was generated to target the VFP EF Provider Version 1.  You will need to change providerName in the connection string to use VfpEntityFrameworkProvider2 to get Entity Framework to work with the VFP EF Provider Version 2.
  • Add Attribute the DbConfigurationTypeAttribute to your DbContext class using the VfpDbConfiguration type.

* Here is a video showing everything mentioned in this post.


  1. HI Tom, great work!

    Question: does this also support the EF SqlMigrationProvider architecture, for live schema updates in production installations?

    Jeff Bowman
    Fairbanks, Alaska

    Comment by Jeff Bowman — March 13, 2015 @ 7:22 pm

    • No, the migration code wasn’t fully implemented. The code to create the data structure was implemented but the code to update the data structure wasn’t. I don’t expect that it would be that much work to implement but I just never revisited that section of code when migrations were added.

      Comment by Tom Brothers — March 14, 2015 @ 11:58 am

      • Hmm… it doesn’t sound like it’d be too difficult to plug that in. I’d like to help you with that over the coming year, if you’re of a mind to. I was active in the VFP community some years back and I do miss it. There’s been nothing quite like it before or since 🙂

        Comment by Jeff Bowman — March 14, 2015 @ 3:48 pm

      • It would be nice to have someone else look into this code. The project is on github so feel free to implement this feature.

        Comment by Tom Brothers — March 15, 2015 @ 10:00 am

      • Very well, as time permits.

        Jeff Bowman
        Fairbanks, Alaska

        Comment by Jeff Bowman — March 16, 2015 @ 5:36 pm

  2. Hi, I have made the installation of the VFP provider 2 and it worked properly but after restarting the machine and add new tables to edmx, the wizard generates an error indicating that DDEX provider is not installed for the VfpEntityFrameworkProvider2.

    I am using Windows 10, VS 2015 NET.Framework community with EF 4 and EF 6 have validated the machine.config and entries exist and are identical for both 32-bit and 64-bit

    I thank you can guide me to avoid setting VFP provider each time you start window.

    sorry for the English do not write or speak very well

    Comment by David Rodriguez — October 20, 2016 @ 10:15 am

    • Sorry, I don’t understand the issue. Could you send me a screenshot of the problem and possibly a stack trace? tombrothers@outlook.com

      Comment by Tom Brothers — October 21, 2016 @ 6:24 pm

      • Hi Tom

        DDEX is the Visual Studio Data Designer component, required for EDMX. I’m not familiar with the details. A good resource/contact for more info will be ErikEJ, who’s built the provider for SQLCE.


        Comment by intexx — October 21, 2016 @ 6:31 pm

  3. The VFP EF Provider includes a DDEX provider. What I don’t understand is how David got that error. It sounds like he was able to see the VFP Data Source option but then after selecting that he got the DDEX provider error. This situation is not something that I know how to reproduce.

    Comment by Tom Brothers — October 22, 2016 @ 6:39 am

    • My understanding is that there are two levels for DDEX—DataSource and EDMX. Apparently the latter is far more complex; Erik has declined to add it to his provider. Since EDMX is on its way out, this seems like a reasonable choice.

      Comment by intexx — October 22, 2016 @ 12:33 pm

      • Hello, I there was lost this thread, I could arranged for the VfpProvider to work in Vs 2015, what I did was to kill all the processes of Vs 2015 and reinstall the package .MSI, but now in Vs 2017 this no longer work, As you indicate in the conversation I can run the application and the provider works, I can see the entities or tables added, but the message is presented when I am going to add new tables to the model, i send a mail to tombrothers@outlook.com with a image where the message is displayed

        now I use vs 2017 but basicly the messsage is equal

        Comment by David Rodriguez — April 18, 2017 @ 12:49 pm

      • So you were able to add new tables to the model in 2015? That’s certainly unexpected—you’re trying to use the provider with Model First, which isn’t supported.

        Comment by intexx — April 19, 2017 @ 9:17 am

  4. To make it work in VS 2015 kill all VS 2015 processes and reinstall VfpEntityFrameworkProvider as Admin, then add to the “machine.config” of the path “C: \ Windows \ Microsoft.NET \ Framework64 \ v4.0.30319” VfpEntityFrameworkProvider tag of the registered In the “machine.config” of “C: \ Windows \ Microsoft.NET \ Framework \ v4.0.30319” and start VS 2015 and is already enabled, based on the above when the fault occurs I simply kill all VS processes 2015 and reinstall VfpEntityFrameworkProvider

    Comment by David Rodriguez — April 19, 2017 @ 11:29 am

    • Hi, You did can install VFP Provider in VS2017?.

      In my case with VS2017, not see the “VFP Entity Framework Provider (EF4 & EF5)” to be able to choose.

      I install the “MSI” when recently start windows session, therefore not are run VS proccesses.

      Do i have to install somthing manually ?


      Comment by Ariel Cattaneo — March 8, 2018 @ 12:33 pm

      • No, I haven’t figured out how to get it to work in Visual Studio 2017.

        Comment by Tom Brothers — September 4, 2018 @ 5:29 am

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: