views:

668

answers:

2

How would I create a core-data application that syncs with a MySQL database?

Should I implement a SQL-Lite layer and try to sync with MySQL that way?

Or would running web services be better? I want to take advantage of Core Data modeling though.

Is there any way to use Linq? I love linq.

+2  A: 

If you are using CoreData you do not directly accessing its underlying backing store (with the exception of implementing custom atomic stores). If you want to sync with MySQL you need to access the MySQL database (either directly via a libmysql or through an app server) and then marshall that data into your managed objects.

In other words, your CoreData model is completely local and you only should access it via the CoreData APIs. How you get data in and out is a completely seperate issue, and the fact that the underlying storage may be sqlite has no bearing on that.

And no, there is no way to use LINQ on the iPhone. I suppose at some point in the future it might be possible through MonoTouch, but unless you are writing a full MonoTouch app I suspect the marshaling objects back and forth to use it would be very unnatural with Objective-C code.

Louis Gerbarg
Thanks Louis. How would you get data in and out of MySql?
Bryan
A: 

I have code for synchronizing core data with any database on the backend. It uses a web service and does communication via JSON. Not only is it database agnostic but it doesn't care if the data structures are different.

It will be included in the next version of the QuickConnectFamily framework. http://www.quickconnectfamily.org

Let me know if you need the code before the release.a

Lee Barney