With today’s release of .NET provider for Firebird the Entity Framework (version 6) support got even better. But given we’re 3rd party provider, there’s always some steps involved. I created a sample project that shows both approaches to working with Entity Framework – Code First manually and EDMX using wizard (or course you can mix these two together too).
Let’s start with Code First. First you need to install
EntityFramework.Firebird package. This package will install all the related dependencies and modifies
[app|web].config for Entity Framework + Firebird love. It’s good to run
update-package to get latest versions of packages. You’re ready to start coding. Almost. Depending on your system setup you might not have a
DbProviderFactories record in your (mostly)
machine.config. That’s easy to fix. Just add following lines into your
[app|web].config (you can also add
remove element if you want to have it on both places or you’re not sure).
<system.data> <DbProviderFactories> <add name="FirebirdClient Data Provider" invariant="FirebirdSql.Data.FirebirdClient" description=".NET Framework Data Provider for Firebird" type="FirebirdSql.Data.FirebirdClient.FirebirdClientFactory, FirebirdSql.Data.FirebirdClient"/> </DbProviderFactories> </system.data>
That’s it. Nothing scary, right?
Now the EDMX. I suppose you have DDEX provider for Firebird installed and working. You again need to install
EntityFramework.Firebird package and run
update-package to get latest versions of packages. Now make sure the
FirebirdSql.Data.FirebirdClient your DDEX installation is using (the one you have in GAC and have configured in
machine.config) is the same as you have in project. Else the puppy dies. Make sure your project builds and build it. Then you can start adding EDMX as you’re used to.
And that’s it. I would say making EDMX work needs same amount of work as Code First, but it’s more about checking stuff than changing.
If you’d like to see the both methods in action, check the
EF6_Firebird repository. Code First “just works”. For EDMX you need to make sure your DDEX provider for Firebird is installed and working.