Windows Phone Mango Local Database(SQL CE): Introduction | GeekChamp:
LINQ is used to query data, T-SQL queries are not supported

I've already complained about the lack of DataTables on Windows Phone 8.  That still boggles my mind.  Why not make code supra easy to port over to Windows Phone?  When it's easier to reuse my C# code on iOS and Android ($300 a piece and I'm ready to go) than on Windows' own native platforms, something's wrong.

And then I see alternatives like the one above.  Admittedly, that article is pretty old, and mentions WP 7.1, but the use of LINQ exclusively instead of supporting SQL I don't quite understand.

I mean, I know ORMs are the [conventional] way to do things now.  But even they, at least on your standard server-side or desktop stacks, usually end up translating object relations to SQL.  I haven't seen a huge practical advantage for ORMs on the systems I've worked on.  I keep hearing that it makes swapping database engines easier, but I'll keep ignoring that until someone actually replaces SQL Server with PostgreSQL -- and it's painless enough to make up for carrying, eg, NHibernate around for years.

It's really not that all difficult to custom hydrate objects with SQL results, and when it is, you often run into similar trouble trying to shoehorn your data into your ORM via AutoMapper or something similar anyhow.  And in most of those complex cases, it would be much easier for those who know how to do just a little bit more than spell "SQL" to have scripted up a sproc to do what the ORM is doing -- and to have that logic processed on the database server, where it's supposed to be happening anyhow.  I'm almost speechless at this point.  I mean, you're paying how much to have software (the rdbms, to be clear) that's designed to handle complex relationships quickly and efficiently?  Quickly processing complex relationships in your data is your database server's job.  Why do we push that to middleware?

Sorry.  I'll try not to step so close to that soapbox again, as it's horribly difficult not to step up off of Britannia and start spewing.

Anyhow, this convention of object-ing your way to data rather than SQLing your way has gone from convention to serious technical block with Windows Phone.  I don't see how Xamarin abstracts twice -- once from whatever XCode is pushing out to Objective-C or Eclipse to a Java VM, and then again to C# -- on a platform that dips as low, performance-wise, as Android can, and still gives a more fully fledged development platform than Windows Phone.  I mean, heck, VB.NET was a non-trivial attempt to pull VB6 programmers onto the web and OO programming with the least amount of head rethreading possible, and it happened because having Microsoft stack developers on .NET was crucial to that platform's success.  Why the huge investment during the move to .NET but not Windows Phone and "Metro"/Windows App Store?  One platform has been adopted very quickly.  I realize the WP numbers are low, but don't you think some developer love would push adoption in business pretty danged quickly too?  It's all about the barriers to entry, stupid.

Guess this stayed a pretty ranty post.  Sorry.

Anyhow, so my answer so far, since my mobile apps are just for fun, is to create a DataTable shim for Windows Phone, DataTableWP8, that shims just enough to let me use my buggy SQL database, now called SqlDbSharp (because naming is difficult ;^D), on WP8 without rewriting anything.  So far, it's still fun to do, and I've been playing with Visual Studio on my Lenovo laptop as much or more as Xamarin Studio on my new iMac in my free time this week.

Labels: , , , , ,