Entity Framework for SQL Server Compact Edition

c# entity-framework sql sql-server-ce

Question

In Visual Studio 2008 SP1, I attempt to utilize SQL Server Compact Edition and Entity Framework. What I do is this:

1) I start a new Console Application project.

2) I add a new item by right-clicking the project and choosing Add.

3) I decide to include a Local Database with the name Something. sdf

4) I choose the default dataset name on the next page of the "Add New Item" dialog (SomethingDataSet)

The new database Something.sdf is now shown under Data Connections in the Server Explorer. 5) I once again right-click the project and choose Add->New Item.

6) I decide to create an ADO.NET Entity Data Model called Model1.edmx by default.

7) I choose Generate model from database on the wizard's next page.

What data connection should your program use to connect to the database, it now asks me. In this box, I have the option of utilizing an existing Data connection or starting from scratch.

I would have anticipated seeing my Something.sdf in the drop-down menu alongside the pre-built data connections, but there is nothing there. I can only choose Microsoft SQL Server, Microsoft SQL Server Database File, and Microsoft SQL Server when I click New Connection; I am unable to select Microsoft SQL Server CE. If I choose Other, the incorrect data source—the ".NET Framework Data Provider for SQL Server"—is shown.

What do I not see here? Why can't I use the Add Entity Data Model Wizard to choose my SQL Server CE database?

1
2
10/16/2009 2:13:54 PM

Accepted Answer

I'm not sure whether this is the same issue, but I believe that in order to have CE as an option in the dropdown, I had to download SQL Server Management Studio Express 2008. I'll investigate it more and get back to you with further information.

Edit:

If you go to the following location: C:WINDOWSMicrosoft.NETFrameworkv2.0.50727CONFIG machine.config

The following node should be located:

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

If you cannot locate it, please let me know.

Edit 2:

I've been using Visual Studio 2010 beta 1, and I can choose SQL CE using the procedure you outlined. However, I launched 2008 and had the same outcome as you, namely that SQL CE is no longer an available datasource.

As stated in the following link, I had to install "Microsoft SQL Server Compact 3.5 SP1 Beta for Entity Framework Beta 3" when I originally began my project back in 2008.

http://technet.microsoft.com/en-us/library/cc835494.aspx

However, it seems that the download is no longer accessible. The link they offer in the article is broken, and I was unable to locate it elsewhere.

It turned out that all I needed to do was add the node I indicated above to the machine.config in the C:WINDOWSMicrosoft.NETFrameworkv4.0.20506Config directory after upgrading to 2010 and running into the identical issue with CE not being an option. I then tried re-installing VS 2008 SP1.

Sorry I couldn't be of more assistance, but I believe your 2008 SP1 is experiencing the similar issue as mine.

Edit 3: It seems that 2008 SP1 should 'simply work' without requiring the installation of a "Compact 3.5 SP1 Beta for Entity Framework," but when I attempted to install it, I still had the same issue. The only option left is to attempt a fresh installation of certain SQL CE 3.5 components.

4
10/16/2009 4:01:59 PM

Popular Answer

Close Visual Studio and run the SSCEVSTools-esn.msi program from the VS2010 DVD if you are looking for the option to build a Sql Server Compact 3.5 connection but can't seem to locate it. WCU SSCE Visual Studio 2010 D:



Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow