SQL Server Compact Edition with Entity Framework
I am trying to use SQL Server Compact Edition with Entity Framework in Visual Studio 2008 SP1. That's what I'm doing:
1) I am creating a new project of type Console Application.
2) I right click on the project, select Add-> New Item.
3) I want to add a local database called Something.sdf
4) On the next page of the "Add New Item" wizard, I select the default dataset name (SomethingDataSet)
The new database "Something.sdf" is now displayed in Server Explorer under Data Connections. 5) I click on the project again and choose Add-> New Item.
6) I want to add ADO.NET Entity Data Model with default name, Model1.edmx
7) On the next page of the wizard, I choose to create a model from a database.
Now he asks me, "What data connection should your application use to connect to the database?" In this dialog I can choose between using a previously created data connection or to create a new one.
The dropdown with pre-built data connections is empty (I would expect to see my Something.sdf here?). When I click New Connection, I can only select Microsoft SQL Server, Microsoft SQL Server database file and - I cannot select Microsoft SQL Server CE. If I select Other, the data source ".NET Framework Data Provider for SQL Server" is displayed, which is not what I want.
What am I missing here? Why can't I select the SQL Server CE database in the Create Object Data Model Wizard?
source to share
Not sure if this is the same problem, but I seem to have had to download SQL Server Management Studio Express 2008 to get CE as an option in the dropdown. I'll look in more detail and give you a better answer.
Edit:
If you go to: C: \ WINDOWS \ Microsoft.NET \ Framework \ v2.0.50727 \ CONFIG \ machine.config
you should find the following node:
<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"/>
Let me know if you don't find it.
Edit 2:
I am running VS 2010 beta 1 and the process you pointed out allows me to select SQL CE. However, I activated 2008 and got the same result as you, SQL CE is no longer an option for the data source.
I first started my project in 2008 and I had to install "Microsoft SQL Server Compact 3.5 SP1 for Entity Framework Beta 3" as stated in the following link:
http://technet.microsoft.com/en-us/library/cc835494.aspx
However, the download does not seem to be available anymore. I couldn't find it anywhere and the link they provide in the article is broken.
After upgrading to 2010 I ran into the same problem where CE was not an option, so I tried to reinstall VS 2008 SP1 and eventually found out that all I had to do was add the node I mentioned above to the machine.config file at C: \ WINDOWS \ Microsoft.NET \ Framework \ v4.0.20506 \ Config.
Sorry I couldn't help more, but I guess my 2008 SP1 suffers from the same problem as yours.
Edit 3: It looks like 2008 SP1 should "just work" without having to install "Compact 3.5 SP1 Beta for Entity Framework", but when I tried to install Service Pack 1 for 2008 I still get the same symptom. Just Thought Left is trying to reinstall some of the SQL CE 3.5 components.
source to share
No design-time support for SQL CE 4.0 CTP1 in VS2010. so you cannot use SQL CE 4.0 with Entity Framework.
But it can be created using several hacks.
Below is a link to a tutorial for using Entity Framework for SQL Ce.
http://getsrirams.blogspot.com/2010/10/adonet-entity-data-model-for-sqlserver.html
source to share