Posts

Yes, I can confirm that 15.7 preview solves the problem, don't forget to also install the update on the Mac.
But... it gives problems, building of the app fails most of the time with random errors, and when it build and starts on the iPhone it now gives a 'The App has been terminated'. ...(It actually started once, I saw the problem was gone, but can not start the App again)

If you want to start a similar project today, I suggest you use the built-in project templates. You can do so via File > New > Project in the menu, and select Visual C# > Cross-Platform in the left hand side of the New Project dialog, and then choose Mobile App (Xamarin.Forms) from the list of project templates, and then the Blank App template in the dialog that follows. Be sure to choose .NET Standard as the Code Sharing Strategy.

Pay attention to some of the current workarounds earlier in this thread. Notably, for the Android project you may want to add a packages.config to your project instead of using the new PackageReference-style references in the *.csproj file, as there is an open issue where using packages.config is a workaround.

@davefxy said:
How did you know what packages to put into the packages.config file? If these are not listed in the csproj file?

Start with a valid but empty packages.config in your Android project. (See first example below.) Then use the "Manage NuGet Packages" menu item (available if you right-click your project's References) to find and install the necessary packages. Start with Xamarin.Forms, and Microsoft.EntityFrameworkCore.Sqlite for EF Core. The package manager, by default, pulls in the package you ask for, and the packages that it in turn depends on. If you open your packages.config after installing packages, you'll see that's where they end up. (See second example below.)

How can you say this works I am trying to get data annotations to work in the standard way and it doesnt. I am using these in my dbcontext in my web api and I want to be transpose it from json to an object so doesnt xamrian still need the dataannotation to understand that in the form of.

@MarkZhukovsky You're welcome. I was intending to revisit the sample when Entity Framework Core 2.1 is released. I'll remove any unnecessary workarounds then (i.e. System.Runtime.CompilerServices.Unsafe) that may have been required prior to VS 15.7.x.

As for where you can find the local database in the Todo sample, it will vary based on the platform. Look for the FileHelper.cs file within each platform project and there you'll see where the database path gets constructed. Here is the iOS app's FileHelper.cs: https://github.com/cwrea/XamarinTodo/blob/NETStd20_EFCore203/Todo.iOS/FileHelper.cs. You might modify yours to output the return value to debug output, so you can see the full path. On my Mac, I use a tool called iExplorer to grab copies of the SQLite database from the app's Library/Databases folder.

As I stopped by this thread a few moments ago, I thought I would remark that I have tried to adapt the sample for Entity Framework Core 2.1 which came out a couple of weeks ago, but there remain issues preventing it from being compiled with Xamarin.iOS.

Anybody interested in following EF Core progress on Xamarin should check out these recent/open GitHub issues:

As for the ER Core adaptation of the XamarinTodo sample, the most recent published version is on EF Core 2.0.3: https://github.com/cwrea/XamarinTodo/tree/NETStd20_EFCore203. I removed some workarounds that are now unnecessary on Visual Studio 15.7.x. e.g. the projects now use package references instead of package.config.

Once I get a version successfully building and running on EF Core 2.1, I'll post an update here.

It has been confirmed that Azure Mobile Apps unfortunately will not support .NET Core, so the offline sync capability (that comes in their starter solution) with .net core backend is off the table.

Offline-first approach with bidirectional synchronization would really take this sample to the next level. Wondering if you've given this any thought? I was considering playing around with this free library for SQLite syncing to a SQL db on Azure. @ChrisWRea

@ChrisWRea, VS 15.8.1 appears to fix the System.Memory compile error for iOS (github.com/xamarin/xamarin-macios/issues/4168) and I am able to deploy to a physical device, but I am still getting the AOT error related to Nullable columns.

When you circle back to this, I would be interested to know if you are seeing similar behavior, as the Nullable columns issue is marked as "Closed" in GitHub (github.com/aspnet/EntityFrameworkCore/issues/9249) and "RESOLVED FIXED" in the Xamarin Bugzilla (bugzilla.xamarin.com/show_bug.cgi?id=59184) and (bugzilla.xamarin.com/show_bug.cgi?id=58424).

i wonder how is the performance on cascading and getting parent with children on multiple level.
For example, if you want to get a school object with all classes and all students as 3 layers. How fast it ist?
and if you delete a school object to cascade delete on all related classes and students.
Based on my experience sqlite-net was super slow. thats why i decided to use akavache which is based on sqlite as well but working asynchronous key value store.