MongoDB for C# and iPhone app

随声附和 提交于 2019-12-05 23:07:49

The typical iPhone architecture is to have your application call out to a web service. Even if it is possible to use a MongoDB driver directly from a mobile client I would not recommend it. For a few reasons.

You are basically talking about doing client server architecture where your client application talks directly to the datastore (MongoDB.) What about security? When any authenticated client talks directly to the datastore all sorts of bad things can happen.

Tightly coupling your client application directly to any given data access technology is dangerous in that it would require you to rewrite your client if for some reason you needed to change your data access solution.

It is more common these days to have your client applications go through a data access tier and when the Internet is involved this tier often involves a web service of some sort unless you want to get elbows deep writing server code.

Think about writing a RESTful api exposing your datastore to your iPhone client. I've heard good things about Open Rasta (C# REST library)

Edit - More about hosting MongoDB on the iPhone

Sorry I didn't understand that you wish to run MongoDB locally on iPhone. MongoDB is a server. I do not believe that it is embeddable as an in-process datastore. And it is not possible to run more than one process on the iPhone.

If you are familiar with C# you might want to check out MonoTouch. It allows you to run C# applications on iPhone. There is a nice library for using SqlLite which is supported by iPhone.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!