Steve Macdonald
Steve Macdonald

Reputation: 1785

MvvmCross, SQLite, Store App?

I can get MvvmCross working with a Windows 8.0 Store App. I can get SQLite working with a different Windows 8.0 Store App.

I cannot figure out how to get MvvmCross + SQLite working on a Store app.

I always get this Exception:

Failed to construct and initialize ViewModel for type Flux.Core.ViewModels.TestViewModel from locator MvxDefaultViewModelLocator - check MvxTrace for more information

I've spent the entire day searching with google, hoping to solve this myself. The KittenDb example is about as close as I've come, but there's no Store app example in there. (I got the Kitten example working no problem on Android.)

Is there any working example out there?

Thanks!

Upvotes: 2

Views: 460

Answers (1)

Stuart
Stuart

Reputation: 66882

SQLite for Windows Store is a C++ component and comes in separate ARM, x86 and x64 binaries.

To install it, you need to add a Visual Studio extension - instructions in http://blogs.msdn.com/b/robertgreen/archive/2012/11/13/using-sqlite-in-windows-store-apps.aspx - and then reference that extension from your UI project.

To then link the correct platform version of the Cirrious.MvvmCross.Plugins.Sqlite.WindowsStore.dll assembly to your UI project, you further need to adapt your .csproj file with a <Choose> block a bit like the one in https://nuget.codeplex.com/discussions/446656

There is an open issue within MvvmCross to make SQLite easier to use from nuget (see https://github.com/MvvmCross/MvvmCross/issues/307) but I don't know if anyone is actively working on addressing this issue currently - currently users seem to be just putting up with challenges of different processor architectures and following the manual steps to adapt their projects.

Upvotes: 3

Related Questions