none
Driver for SQL Server CE 4.0 for Entity Framework

    Dotaz

  • 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.

     

    24. ledna 2011 8:26

Odpovědi

Všechny reakce

  • 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.
    24. ledna 2011 12:17
    Moderátor
  • 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.

     

    24. ledna 2011 16:18
  • 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

    15. února 2011 20:46
  • 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.
    19. února 2011 15:58
    Moderátor
  • can anyone representing MS explain the logic of not providing standard designer support for sqlce 4 in vs2010?

    workarounds!  the emporer has no clothes!

    22. února 2011 20:51
  • 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.
    23. února 2011 8:19
    Moderátor
  • 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. :)



    11. dubna 2012 4:13
  • Amazing, thanks for the tip !!!!
    10. května 2012 0:26
  • 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.


    9. srpna 2012 5:25
  • 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

    9. srpna 2012 6:23
    Moderátor
  • 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>




    4. listopadu 2013 5:40