Is it possible to use Entity Framework Core in Xamarin cross-platform projects?

entity-framework-core uwp xamarin xamarin.ios


I'm evaluating Xamarin for a new project that will be targeting different platforms (iOS, Android, UWP).

When I add the NuGet package to my PCL project, I get the following error :

Impossible d’installer le package « Microsoft.EntityFrameworkCore 1.0.1 ». Vous essayez d’installer ce package dans un projet ciblant « .NETPortable,Version=v4.5,Profile=Profile111 », mais le package ne contient aucun fichier de contenu ou référence d’assembly compatible avec cette infrastructure.

So I guess that EF Core is not supported by Xamarin.

  • Are there any info about this matter?
  • Will Xamarin support EFCore in the future ?
  • If not, do you know any other ORM wich are Xamarin compatible ?

Many thanks in advance, Julien

5/20/2017 6:41:48 AM

Accepted Answer

This is a current action item for the EF team:

As of 10 days ago there is a task to see if this will be supported:

Now that Xamarin supports netstandard we are going to do another round of testing and see if we are ready to have Xamarin be one of our supported scenarios. Once we've looked at this we can make a call if we call it supported for 1.1. I'm going to start by porting a sample app I did back in the beta5 days.

11/4/2016 7:22:45 PM

Popular Answer

For some time I've also been interested in EF Core working on Xamarin.iOS, and have been monitoring the progress of the respective projects. There's good news now:

Recently, a blocker bug was fixed (NotImplementedException resulting from queries on iOS). The bug is addressed by Xamarin.iOS 10.10+ on new Mono 5.0 release. Quoting the github issue:

divega commented:
We are closing this issue as we believe the root cause has been removed in newer versions of Xamarin iOS. That said, support for Xamarin is still considered a work in progress. Please refer to the call for help at #4269 (comment), and create new issues for any problems you find.

Since then I was able to adapt Jon Douglas' Xamarin.Android EF Core sample (see here) to run on iOS, here.

Today I adapted the Xamarin.Forms "Todo" sample app which used SQLite.Net PCL to instead use EF Core. Works on all 3 platforms. See my adaptation here. I also posted about it in the Xamarin Forums.

Related Questions


Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow