-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Xamarin support #4269
Comments
@econner20 Xamarin.Forms is not supported yet. We would like to support it in the future but likely not for the 7.0.0 release. I thought we had an issue tracking it, but it doesn't look like we do, so we'll use this one. |
BTW as expected you get an error stating that the package does not support the required platforms when you try to install it.
|
What about Xamarin.Android and Xamarin.IOS (using native UI)? |
@robertbaker - this work will likely light up all that as well |
@rowanmiller Is there any road-map on this? |
@reader-man not yet. At this stage I think it will be something we tackle once we get 1.0.0 released. |
Thank you very much, |
Hi, It is very useful that EF Core works on Xamarin.Forms. This scenario would allow the server code can be transferred to a mobile device together with the client side code without any change, allowing very easily implement the execution of an application in off-line mode using the same ORM in both scenarios (on-line and off-line). Thanks! |
Now that 1.0.0 is released, any news on this ? |
Hi, See this link: https://docs.efproject.net/en/latest/efcore-vs-ef6/features.html Application Models Section. EF Core is built to work on Xamarin when support for .NET Standard is enabled in Xamarin. Good news! |
@Suriman If EF Core works with Xamarin.Forms, then the party just began. |
Ideally we get .NET Standard support in Xamarin, and then EF Core will work there (since it already targets .NET Standard). We're discussing timelines etc. with the Xamarin team to work out when this would light up. If it ends up being a long way out, then we may look at other options to light up on Xamarin. |
Hi @rowanmiller , When EF Core supports Xamarin.Forms, what databases will be supported? SQLite?, MySQL?, Siaqodb? Realm?, VelocityDB?. Very good news, thanks! |
@Suriman Our first priority is local SQLite databases. |
@rowanmiller thanks, the timeline is the essence of patients or neglect. so we don't wait for unlimited time, so please, if a timeline can be given from XF team, then we can order our schedules/projects/ideas accordingly, either to wait, or implement what we need our-self's. |
essential support for "mobile first" |
My first Attempt to see the problems when installing Microsoft.EntityFrameworkCore.Sqlite, in a Xamarin.Forms solution, that has an android+iOS+UWP+Windows 8.1+ Windows Phone 8.1 projects, and it gave this error, and did not continue:
and this is the nuget output: |
@reader-man that is the expected result, as EF Core does not target those TFMs and Xamarin doesn't yet support .NET Standard, which EF Core does target. This is an interim state while all our technologies catch up with .NET Standard. |
I migrated my Xamarin Forms project to project.json and netstandard and all is going well until I try to use EF Core. The problem is when it first hits any EF code I get a System.TypeLoadException: Could not load type 'System.Reflection.TypeExtensions' from assembly 'System.Reflection.TypeExtensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. error. However it appears that EF Core should be using version 4.1.0 and not 4.0.0 so I am very confused by this message and I am not sure how to get around it. It appears that this may be because the System.Reflection.TypeExtensions assembly is not included in the output even though the Microsoft.EntityFrameworkCore is included and used in the project although I am still not sure why it says it is looking for 4.0.0 when it errors. Any suggestions or timelines on getting full Entity Framework Core support into Xamarin Forms projects? Thank you. |
@wjvii . EF Core will be supported in Xamarin.Forms when Xamarin migrates Xamarin.Forms to .NET Standard Library. According to my contacts, it will be in September. |
@Suriman https://blog.xamarin.com/net-standard-library-support-for-xamarin/ @rowanmiller what happens now? |
Ok, I gave it a try. For someone whom might have some trouble converting it, just edit package.json like below: {
"supports": {},
"dependencies": {
"Microsoft.NETCore.Portable.Compatibility": "1.0.1",
"NETStandard.Library": "1.6.0",
"Xamarin.Forms": "2.3.1.114"
},
"frameworks": {
"netstandard1.5": {
"imports": "portable-net50+win8+wpa81+wp8"
}
}
}
And I went though EFCore. found few problem.
I was soooo close to get party started. damn. |
I see there is an updated SQLite.Native package version 3.12.3 that appears to resolve the issue above about the MonoAndroid target version. I was able to compile and run my Xamarin Forms Android project but when I hit the line of EF code to retrieve data from the database it breaks with a System.NotImplementedException: The method or operation is not implemented when executing a simple db.table.ToListAsync(); I am not sure if it is the issue but it appears that the Android bin folder is missing some assemblies that I would think are needed like System.Linq, which does appear in the UWP project. Is there something that I have to do in the Android project for it to incude the necessary assemblies or is that the wrong conclusion in the first place? BTW, the UWP version of the app compiles and runs and appears to have all the appropriate assemblies it needs because it can access data in the included SQLite database without a problem. This is also somewhat related to #255 |
Not knowing the root cause I was hoping the issue I reported above would be solved by an update to NuGet and so I installed NuGet 3.5 RC this morning and the final build for Android is still missing files required for Entity Framework. Can the EF Team give us an official update please on the status of EF Core with Xamarin and Xarmarin Forms now that Xamarin has support for .NET Standard. Thank you. |
Clearing up milestone to discuss in triage and with @rowanmiller. From the comment in #4269 (comment) it seems that Xamarin's implementation of .NET Standard has issues blocking EF Core from working, and at the minimum we should catch up in our conversation with the Xamarin folks about these. |
@JonDouglas Let me think, at the first I used packages from I can change packages to |
I wrote a bit of a blog on this to maybe help others with Xamarin.Android. http://www.jon-douglas.com/2016/12/28/xamarin-android-entity-framework/ |
@JonDouglas Thanks for your article, I promise I will write a Persian article about EF in Xamarin! |
@JonDouglas @al1b Please adopt cross-platform speech (project.json for now) |
@JonDouglas following your examples, I came up with something this (I'd prefer to exclude imports, and use netstandard1.6 but I couldn't get the latter to work still):
I can restore that project, build it, and reference it from my Xamarin project, but when I try to compile and run the Xamarin project, I get this:
Help, anyone? |
@bugmenot2 you need to install "Microsoft.EntityFrameworkCore.Sqlite" on android project as well. (keep doing this for each library when you get similar error) |
@bugmenot2 |
@JonDouglas I've heard project.json would be phased out, that's why I said "for now". Not sure what you mean about netstandard. Are you even sure it's going to be .csproj and as we know it? Either way, I think project.json is still the correct way to communicate (as this thread testifies), not screenshots and GUI directions. |
@abdu292 Thanks, that was it, but why isn't dotnet build sufficient? It is supposed to build dependencies in. |
@JonDouglas Got
trying to install to my Xamarin.Droid project my nuget package constructed using the identical |
@bugmenot2 What do you mean |
@JonDouglas I mean Microsoft.EntityFrameworkCore.SqlServer was an additional dependency, but the same happens with the verbatim project.json from your zip (in EntityFrameworkXamarin/EntityFrameworkXamarin.Core/). Excluding Microsoft.NETCore.Portable.Compatibility makes the error go away for the compile time, but results in the following error at runtime:
This is in contrast to a .NET Core console app which depends on the same package of mine and executes without problems. |
FYI, we got word from Xamarin that the issue reported at #4269 (comment) by @al1b (the |
I have a sample project at github here. |
Closing as based on other customer reports we believe things generally work with the latest versions of Mono and Xamarin. However we are missing test coverage for Xamarin and we need to figure out how we can do it. I have created a new issue for this: #8792. For anyone that finds new issues in working with EF Core and Xamarin, pelase create new issues with appropriate details and repro code. |
Is it possible to use EF7 for SQLite in an Xamarin Cross Platform PCL targeting iOS, Android, WinPhone, WinStore and UWP? I currently have a PCL for the above scenario using SQLite.NET PCL (https://github.com/oysteinkrog/SQLite.Net-PCL) but would like to look at the possibility of using EF7.
If so, any documentation or samples?
The text was updated successfully, but these errors were encountered: