[转] Entity Framework Query Samples for PostgreSQL
原文链接:
http://www.cppblog.com/xcpp/archive/2009/09/08/ef_samples_for_postgresql.html
As a PostgreSQL fans as well as a .NET user, I used PostgreSQL in a couple of .NET projects and it works great. Now LINQ and Entity Framework (EF) become more and more popular so it is natural that I want to adopt these technologies into projects too. At first I tried DB LINQ, but obviously it is not ready to use (descried in my previous post). So I quickly switched to entity framework.
Microsoft designed EF to support not only its SQL Server. It announced a lot of supported (with supported drivers) 3rd party databases listed here. Luckily my favourite PostgreSQL is present (Npgsql).
Microsoft also released a lot of great samples for EF, and I started to learn EF from this one: http://code.msdn.microsoft.com/EFQuerySamples (it looks fancy and rich). Then I ported the sample database NorthwindEF to PostgreSQL to test if EF for PostgreSQL really works. The initial test shows it works graet: almost all samples can run with PostgreSQL smoothly.
The translated SQL queries also looks good.
I uploaded the ported EF sample for PostgreSQL here (AFAIK there is no official documents on Internet for EF support of PostgreSQL/Npgsql, so this sample can be a good start).
Microsoft designed EF to support not only its SQL Server. It announced a lot of supported (with supported drivers) 3rd party databases listed here. Luckily my favourite PostgreSQL is present (Npgsql).
Microsoft also released a lot of great samples for EF, and I started to learn EF from this one: http://code.msdn.microsoft.com/EFQuerySamples (it looks fancy and rich). Then I ported the sample database NorthwindEF to PostgreSQL to test if EF for PostgreSQL really works. The initial test shows it works graet: almost all samples can run with PostgreSQL smoothly.
![](http://www.cppblog.com/CuteSoft_Client/CuteEditor/images/emsmiled.gif)
I uploaded the ported EF sample for PostgreSQL here (AFAIK there is no official documents on Internet for EF support of PostgreSQL/Npgsql, so this sample can be a good start).