English 中文(简体)
Entity Framework with File-Based Database
原标题:

I am in the process of developing a desktop application that needs a database. The application is currently targeted to SQL Express 2005 and works wonderfully. However, I m not crazy about having this dependency on SQL Express and would prefer to use a small file-based database.

My problem is that I am using Entity Framework. I have tried both SQL Compact and SQLite, and they both have bizarre problems with EF v1. I get errors creating the Model, invalid models when it does get created... it s a nightmare.

I m about ready to give up and write a data layer and repository in the good-old-school Connection/Command pattern. Not my favorite plan...

Is there a lightweight, file-based database out there that plays well with EF?

OR

Is there a better ORM tool that I should use instead of EF with my lightweight DB?

最佳回答

Mindscape LightSpeed has superb handling for file system databases (such as SQLite) and is free for small databases.

It s fairly straight forward to make the move as it has a LINQ provider, Visual Studio integrated designer (including supporting SQLite on the design surface) and there s significant help on getting up and running fast :-)

问题回答

I believe NHibernate supports both SQL Server Compact Edition and SQLite. That is the route that I would recommend you take.

http://www.nhforge.org/doc/nh/en/index.html#configuration-optional-dialects

Visual Studio 2010 with Entity Framework 4.0 is now in Beta 2 and has a Go-Live license, so if you don t mind using beta software you can have all it s goodness now. I believe it has much better support for SQL Server Compact Edition.





相关问题
Entity Framework with File-Based Database

I am in the process of developing a desktop application that needs a database. The application is currently targeted to SQL Express 2005 and works wonderfully. However, I m not crazy about having ...

Assistance with CakePHP model relationships

How would I represent the following in a CakePHP model? Product ======= product_id .... Cart ==== cart_id .... Carts_Products ============== cart_id product_id quantity

join across databases with nhibernate

I am trying to join two tables that reside in two different databases. Every time, I try to join I get the following error: An association from the table xxx refers to an unmapped class. If the ...

How are Models (in MVC) and DAOs supposed to interact?

How are models and DAOs supposed to interact? I m in the process of putting together a simple login module and I m unsure where to put the "business logic." If I put the logic with the data in the ...

Convert date to string upon saving a doctrine record

I m trying to migrate one of my PHP projects to Doctrine. I ve never used it before so there are a few things I don t understand. In my current code, I have a class similar to this: class ...

热门标签