1

I just started learning Xamarin, and encountered a lot of obstacles like not being able to use the standard SQLite.Net in a PCL.

After trying a lot of other solutions without success, I found out that MvvmCross perfectly solved all my problems so far.

So thumb up Stuart, really great job!

Now I’m thinking, what if I also want to have a ASP.Net web project? Can I still reuse the “Core” project (the project that’s shared by all platforms)?

I know that for the HTML UI, we cannot bind the UI elements to the ViewModel because the ViewModel is on the server and the UI is on the client (actually, for my current web project, what I did is JSON serialize the ViewModel and send it to the client and use Knockout.js to do the binding).

But even if we need to rewrite the logic of the ViewModel for the web project, it’s still very beneficial to reuse the “Core” project.

So I tried to create a ASP.Net MVC project and reference the “Core” project which uses MvvmCross and the MvvmCross Sqlite plugin.

And when I use nuget to get the references to MvvmCross in the web project, the “platform specific version of MvvmCross” I get is the WPF version (I guess that’s because they both use .Net Framework). That shouldn’t be a problem, since I just need to reference some other dlls that WPF needs.

But the real issue is when I run the web project, I get an error:

Unable to load DLL 'sqlite3': The specified module could not be found.

And based on google search result, I changed the name of the file “System.Data.SQLite.dll” to “sqlite3.dll”, and then I get another error:

Could not load file or assembly 'sqlite3' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Then I was stuck. So am I missing anything or is it simply not gonna work?

Btw, I also created a WPF UI project, and I also encountered the 1st error, but after I renamed the file “System.Data.SQLite.dll” to “sqlite3.dll”, everything works fine, I didn’t get the 2nd error. And the “System.Data.SQLite.dll” I get from Nuget is the x86 version.

Thanks

1 Answer 1

2

You should be able to download an official sqlite3.dll for windows on http://www.sqlite.org/download.html - one developer wrote about this on https://github.com/slodge/MvvmCross/wiki/Sqlite-plugin

On the idea of reusing services from mobile apps within server side web apps, Mvvmcross itself doesn't tackle this area - fundamentally the lifecycle and user flow (single vs multiple) is too different for most web apps. Some 'business logic' and 'model' code can be reused across to websites, but much other website code may be better constructed centred around frameworks like nancy, fubumvc, simple web, etc.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks Stuart. With this version of sqlite3.dll, everything works fine.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.