开发者

Entity Framework 4.1 code first SQL Server Compact 4 in Windows Form Application

开发者 https://www.devze.com 2023-03-20 06:08 出处:网络
I\'m trying to use SLQ server compact edition 4 together with entityframework 4.1 with code-first approach in a Windows form application.

I'm trying to use SLQ server compact edition 4 together with entityframework 4.1 with code-first approach in a Windows form application. In asp.NET MVC there are plenty of tutorials, but I can't find any help for windows form applications.

I d开发者_Python百科id the following steps:

  • Created a windows form application
  • Created a new project class library called "library_database"
  • Created some classes and a DbContext
  • Created a app.config file in the project and a connection string to a database file with name equal to my DbContext class name

Now when I try to access my DbContext to add a new object, the application hangs and doesn't stop without returning any exception.

How is this possible? Can you suggest me an approach, tutorial or anything to start? Consider that I can use EF code-first with asp.NET MVC but I never tried with windows applications

Thanks!


I have this tutorial for WPF - also make sure the catch thrown exceptions when debugging! http://erikej.blogspot.com/2011/02/using-sql-server-compact-40-with.html

0

精彩评论

暂无评论...
验证码 换一张
取 消