I need your advice people. I am writing an engineering work project in VS2012 about used car dealership. I have a SQL Database, WCF DataService, WPF application (which is connected succesfuly to WCF) and wanted to create Mobile version for it too. I chose MVVMCross Portable to create Mono For Android and WP7 app with one core. And I have problems here with connecting to my WCF DataService from mobile portable core like:
Unable to add a service reference to the specified OData feed because WCF Data Services is not installed for this target framework. To install a supported version of WCF Data Services, see http://go.microsoft.com/fwlink/?LinkId=253653.
I searched on the internet and it seems that Portable Class Library doesn't support the WCF Data Service yet. I am writing this question to you in hope that there is any solution for this. If not shall I just wait?
or perhaps I need to change my WCF Data Service to normal WCF Service that will work on mvvmcross portable but there will be a lot of work to change in app what I have in WPF done,
or maybe I should get back to MVVMCross Master, that is without portable-class-library, but there is no support for Android to connect with Data Service.
I read a little about Simply.OData but I have no idea how to put it to work succesfuly.
Thanks in advance.
I've connected MvvmCross applications to WCF Basic HTTP data services from all of Droid, Touch and WinPhone (never tried WinRT or WPF - but they should work too)
You are, however, correct that the WCF code will need to be different on the different platforms - this is because the code WCF uses isn't portable.
I think there are 2 basic choices about how to tackle this:
Wrap the WCF code behind a portable interface - an interface that deals in Portable DTO classes and that presents an interface for the Get/Send. You'll then need to write a small class for each platform which maps the portable DTO's to/from the non-portable ones. Tools like AutoMapper may help with this - I haven't tried this on MonoDroid or WinPhone though.
Use file-linking in your core and maintain separate library projects for each platform. For an example of this file linking approach take a look at https://github.com/Redth/WshLst/ - this was for Azure mobile services rather than WCF - but the same principals apply.
Neither of these two approaches is perfect - both put overhead into development - but both still hopefully provide you with a way to share code and build your app moving forwards.
I personally prefer approach 1 - as it provides a clean interface separating the current network stack from my app logic - and it provides me with a technical route to removing WCF and replacing it with something like WebAPI or service stack in the future.
In the near future, there may be a shared Portable Class library profile which supports some WCF functionality across MonoTouch and MonoDroid - but I doubt this will be available at any point soon on Wp or WinRT :/
I'm afraid don't know anything about Simple.OData (this it https://github.com/simplefx/Simple.OData) - I trust the guys who wrote it a lot, but I don't know how well their dynamic
code works on WP and MonoDroid. I believe it should work on both - but there may be issues with any code that relies on Reflection.Emit
.
One final point - whenever you do anything network related on WP, always try to enable GZip compression if you can - WP doesn't provide this by default.