none
Driver for SQL Server CE 4.0 for Entity Framework

    Question

  • Hi

    sorry if this is a dummy question, but I was trying to use the new SQL Server CE 4 database in a VS 2010 SP 1 project. I installed VS2010 SP1 and the Tooling support for SQL Server CE 4. I can create a database and IO can connect to the DB via Server Explorer. Unfortunately when I try to access the DB with the Entity Framework designer ( specifically I try to generate the model from the DB). The Entity Framework designer does not show the SQL CE Framework 4.0 driver in the List of supported connections. 

    Is there anything I am missing?

     

    Thanks for any help.

     

    Monday, January 24, 2011 8:26 AM

Answers

All replies

  • There is nothing you are missing, and you have all the required software, but the EDM Wizard only supports version 4 directly in Web Projects, as noted in this blog post: http://blogs.msdn.com/b/sqlservercompact/archive/2011/01/12/microsoft-sql-server-compact-4-0-is-available-for-download.aspx 

    You can use the workarounds I describe here: http://erikej.blogspot.com/2010/11/using-entity-framework-with-sql-server.html

    or generate the EDMX in a web project and move it to a Class Library / Windows project.


    Visit my SQL Compact blog - http://erikej.blogspot.com - Please mark as answer, if this was it.
    • Marked as answer by HolgerSchade Monday, January 24, 2011 4:18 PM
    Monday, January 24, 2011 12:17 PM
    Moderator
  • Thanks,

    aou are right I was not targeting a WebProject. I was trying to use it in an Outlook Add-In. Thanks for the workaround. I will try to do this.

     

    Monday, January 24, 2011 4:18 PM
  • is this an example of good planning at MS?

    why hasn't the tooling been provided to support the otherwise excellent sqlce 4?

    having to install vs2010 sp1 AND use the 'workaround' projects...what guff

    Tuesday, February 15, 2011 8:46 PM
  • Some features are not enabled in version 4.0 (like replication/sync), and therefore the tendency to "stick" with 3.5 for desktop projects - see this blog post from the team: http://blogs.msdn.com/b/sqlservercompact/archive/2011/01/12/microsoft-sql-server-compact-4-0-is-available-for-download.aspx 

    (In particular the heading: Scenarios not enabled by SQL Server Compact 4.0)


    Visit my SQL Compact blog - http://erikej.blogspot.com - Please mark as answer, if this was it.
    Saturday, February 19, 2011 3:58 PM
    Moderator
  • can anyone representing MS explain the logic of not providing standard designer support for sqlce 4 in vs2010?

    workarounds!  the emporer has no clothes!

    Tuesday, February 22, 2011 8:51 PM
  • Explanation here:  http://blogs.msdn.com/b/sqlservercompact/archive/2011/01/12/microsoft-sql-server-compact-4-0-is-available-for-download.aspx
    Visit my SQL Compact blog - http://erikej.blogspot.com - Please mark as answer, if this was it.
    Wednesday, February 23, 2011 8:19 AM
    Moderator
  • Dear HolgerSchade,

    There is a much more easyer way to get your MS SQL CE4 database in entity object in your windows forms or class library.

    1. Install SP 1 for VS 2010

    2. Install MS SQL CE 4 Toolkit for VS 2010

    3. In VS click View -> Server Explorer

    4. In Server Explorer panel right click on Data Connections, select Add Connection

    5. In the Add Connection window change provider to MS SQL Server Compact 4.0, select your database and set password, press OK

    6. In Server Explorer click on Open SQL Server Compact Toolbox at the top of the Server Explorer panel

    7. In appeared window right click on your connection and click Add Entity Data Model to current Project

    8. In appeared window enter entity name and select tables and objects from database you need and click OK

    VIOLA! - you have entity object with SQL CE 4 in your project.

    Hope this helps. :)



    • Edited by Khisrav1976 Wednesday, April 11, 2012 4:17 AM
    Wednesday, April 11, 2012 4:13 AM
  • Amazing, thanks for the tip !!!!
    Thursday, May 10, 2012 12:26 AM
  • Hi friends,

    I have installed Visual Studio 2010 and after that i downloaded SQL Server CE 4.0 and Installed to My PC.

    But I have a problem that, 

    When I am opening Add Connection from Server Explorer, SQL Server CE 4.0 does not Display in Choose Data Source Dialog Box.

    It shoes only SQL Server CE 3.5 and other option even though i have installed SQL Server CE 4.0.

    What is i ma missing ? Please Help.


    Thursday, August 09, 2012 5:25 AM
  • You must install VS 2010 SP1 and also the SQL Server Compact Tools for 4.0 / VS 2010 SP1.

    Please mark as answer, if this was it. Visit my SQL Server Compact blog

    Thursday, August 09, 2012 6:23 AM
    Moderator
  • I followed the same path as Krisav1976 did to get the EDMX file in the right place.  In my case it's because the EDMX and context live in a separate project.  For some reason it seems MS thinks that webapps are just a single project?!

    1. Install tools & all that, register in server explorer, etc etc add tables etc
    2. Right click on the connection and generate EDMX in the current project (e.g. /Data/ not /Web)

    Now, everything works for tables that were added AT THE START.  However, if you try to update the model from the database (the way to add tables, refresh, etc) then you will still have this same issue with the connection not being registered.  All you have to do is copy the DB Provider Factory registration from your web.config (if it is there) to the other project's app.config.  In my case, I just copied this snippet (other provider registrations removed, we use >1 db).

    <system.data>
      <DbProviderFactories>
        <add name="Microsoft SQL Server Compact Data Provider 4.0"
              invariant="System.Data.SqlServerCe.4.0"
              description=".NET Framework Data Provider for Microsoft SQL Server Compact"
              type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
      </DbProviderFactories>
    </system.data>




    Monday, November 04, 2013 5:40 AM