HighwayFramework / Highway.Data

The fastest and smoothest way to great architecture
http://hwyfwk.com
MIT License
73 stars 30 forks source link

TypeInitializationException #113

Closed michaeltnguyen closed 7 years ago

michaeltnguyen commented 7 years ago

I have a helper class for doing a select *.

    public class GetAll<T> : Query<T> where T : class
    {
        public GetAll()
        {
            ContextQuery = c => c.AsQueryable<T>().Select(i => i);
        }
    }

I'm using Highway.Data-7.0.0-alpha3, and this is within a Xamarin.Forms project.

_repository.Find(new GetAll<Driver>())

works fine on android, iOS simulator, and windows UWP. However, when running on an iOS device, I get the following exception:

{System.TypeInitializationException: The type initializer for 'Microsoft.EntityFrameworkCore.Query.ExpressionTranslators.Internal.StringCompareTranslator' threw an exception. ---> System.InvalidOperationException: Sequence contains no matching element   at System.Linq.Enumerable.Single[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] predicate) [0x00070] in <efafd07f54d8415e9134a80c889fcffb>:0    at…}

I'm not sure how to proceed, and I'm not sure if it's an issue with Highway.Data, EF, or SQLite on iOS. Any ideas?

michaeltnguyen commented 7 years ago

For anyone having this issue, EntityFrameworkCore 1.1.2 is not compatible with iOS. This is on the roadmap for EFCore 1.2, but until then, SQLite-net-PCL works just fine.

https://xamarinhelp.com/entity-framework-core-xamarin-forms/

https://developer.xamarin.com/guides/xamarin-forms/application-fundamentals/databases/