mvvmcross sqlite-net plugin for monotouch - sqlite

I am implementing the excellent mvvmcross library in a multiplatform enterprise application. The monodroid sqlite plugin is working - I now need to implement monotouch functionality though.
I was interested if anyone had developed an accompanying sqlite plugin for the ios/monotouch platform and describing the complexity involved and path taken, stumbling blocks etc.
Cheers

This should be quite straight-forward to...
Using MonoDevelop on the Mac, create a new MonoTouch library project - Cirrious.MvvmCross.Plugins.Sqlite.Touchin the folder /MvvmCross/Cirrious/Plugins/Sqlite/
Set the build paths for debug and release to ../../../../bin/Touch/debug and ../../../../bin/Touch/release
Add references to: Cirrious.MvvmCross (core PCL), Cirrious.MvvmCross.Touch (core MonoTouch methods), Cirrious.MvvmCross.Plugins.Sqlite (core SQLite functions)
Add the 'boilerplate' plugin file - which just registers the connection factory in DI - see below
Add the connection factory class - see below
Add a link to the sqlite-net file in the Droid plugin - SQLiteNet.cs
Build
When you use this plugin in a MonoTouch UI project, you will need to register the plugin instance in your setup.cs file - just as you do all Touch plugins - this is because we can't use Assembly.Load() at runtime
You may also need to do something special to use the plugin at runtime too - not sure - not used SQLite-net in MonoTouch yet - the Sqlite samples should help - https://github.com/praeclarum/sqlite-net/tree/master/examples/StocksTouch
My attempt at this is:
https://github.com/slodge/MvvmCross/tree/vnext/Cirrious/Plugins/Sqlite/Cirrious.MvvmCross.Plugins.Sqlite.Touch
But I've not tested this.
Would love to read about it if it works... and to see a pull to fix it if it doesn't.

Have you seen this blog post? http://slodge.blogspot.nl/2012/10/a-sqlite-example-vnext-portable.html
"Note that I've only done the Droid implementation of this plugin so far, but I think all of the rest - WP7, MonoTouch, and WinRT (and beyond) should be straight-forward - and that the same SQLiteNet.cs file (#if's and all) will be link-shared between those plugins."
Have you tried using the same SQLite plugin for the monotouch project?

Related

Using sqlite SEE with MVVMCross

I potentially want to use the encrypted version of sqlite (link). Essentially to use sqlite encryption enhancements (SEE) you need to build a version of the sqlite3.dll.
I am using MVVMCross. Is it possible to use the MVVMCross plugins with this version of the ddl, rather than the default version installed on iOS and android. If so how do you do it?
Thanks in advance
The existing MvvmCross plugin doesn't reference the encrypted dll. With that you can't switch them out easily right now i think.
You could just copy the code into your project and use the encrypted version of SQLite. Another option would be to make a fix to be able to switch SQLite version that the plugin uses, make a pull request so MvvmCross can release an update for the current plugin.

How to compile realm-cocoa with source code

Our company's svn cannot allow single file larger than 40mb, realm framework needs 140mb+,so how can I build realm-cocoa with source code on github?
You could instead use the dynamic framework, which is a lot smaller (28,5 MB), through being already linked, but you won't be able to support iOS 7 in that way.
Alternatively I would recommend using a dependency manager like CocoaPods, which helps you with the setup and integration. But as a Core Member of this project, I'm obviously biased in that regard.
If that shouldn't be available for you, then you could theoretically use SVN externals to checkout the realm-cocoa repo (GitHub supports SVN transports), add the Realm.xcodeproj to your Xcode project, set the iOS framework target as dependency target of your app target and link to Realm.framework. But please not that this is not an officially supported way of integration.

What is symfony in the vendor folder?

When I create an app using composer, or install another app created using composer, there is a vendor/symfony folder included.
For example, I installed Laravel using composer. The folder vendor/symfony is present. I am not specifically referencing this in my Laravel app at all.
What is this folder, and it needed? Does the app use it, or composer use it? So if I am using an app created using Composer and dont use composer myself, can it safely be deleted and the app still run? Or could the app be using it?
Thanks
Answer is quite simple: Laravel uses Symfony components.
Check this article: http://www.sitepoint.com/build-php-framework-symfony-components/
Improved Routing Engine
Laravel 4.1 features a totally re-written routing layer. The API is
the same; however, registering routes is a full 100% faster compared
to 4.0. The entire engine has been greatly simplified, and the
dependency on Symfony Routing has been minimized to the compiling of
route expressions.
http://laravel.com/docs/master/releases
The "vendor" folder is a standard in every application / framework that uses composer to manage dependencies. In the "vendor" folder you will find all dependencies (read: libraries) that your applicatication requires.
But you will also find all libraries that your libraries require. In order to minimize code duplication, and thanks to the composer system, most open source projects now reuse parts from other open source projects.
BTW, this is great.
Symfony components are excellent and well documented, so they are currently used by many other frameworks and applications.
Inside the "vendor" you may find other libraries that you did not specifically require yourself, but as long as your correctly use composer, that's not something you should worry about.

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!
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.

Restrictions in creating a plugin

Recently tried the plugin example of Qt.
It didn't work at all and I was confused as to the reason. Then found the solution on one of the forums.
Qt, Application and plugin all three have to be built with the same configuration (Release/Debug)
This works for me as I can build all three in Debug/Release mode. But if I want users to extend my application using plugins I need to provide debug build of my application. (If I provide release build, users will not be able to trouble-shoot the plugin). Qt source is available so it can be built in any mode.
I don't want to provide debug build of my application to users. Is there any work around for this restriction on build mode for plugins?
P.S. I understand users can debug with logging statements, but not sure how many prefer that approach.
This is because Qt has a so called build key which is just a string containing some Qt configuration information, this is documented in the Qt plugin Howto.
So you should just go ahead and provide a debug build of your application for the best results.
You can build debug version (to have compiled in debug configuration) and strip it out of all symbols etc.

Resources