I am currently working on a Xamarin.Android project for a FieldService app. I looked into the standard Xamarin SQLite.NET component for the Data Access Layer, but it does not meet my needs. (I cannot create a PK with multiple fields, for example).
I tried to use the Dapper framework, since I have more experience with that and I think it's pretty awesome.
Couldn't get it to work with Xamarin.Android. I am using Xamarin with Visual Studio 2013. Anyone who knows how to do this?
I tried 3 ways:
Adding Dapper to a Xamarin.Android Class Library. - No errors, but Dapper was not under the
References group in solution explorer and I couldn't use the namespace
Adding Dapper to a "normal" .net Class Library. - Everything worked, I was able to add it, I could use the
Dapper namespace and
Query methods etc. BUT there was an error referencing the project to the main Xamarin.Android application project. (different target framework)
Adding Dapper to a Portable Class Library targeting .NET Framework 4.5 and Xamarin.Android. - Error when adding the NuGet package.
Brief question: How to add Dapper (or other NuGet packages) to Xamarin.Android?
Thanks in advance.
The Dapper NuGet package contains assemblies that target:
So you will not be able to the NuGet package with an Xamarin Android project since this project will target MonoAndroid.
Dapper would need to be recompiled against the MonoAndroid target framework, if possible. Otherwise you would need to look at other alternatives.
Looking at the Dapper GitHub site all the various classes available in the NuGet package are from one SqlMapper.cs file which seems to compile inside an Android project.