有Cocoa的ORM框架,或使用不同的技术实现类似目标的框架? [英] Is there an ORM framework for Cocoa, or a framework that accomplishes a similar goal using a different technique?

查看:99
本文介绍了有Cocoa的ORM框架,或使用不同的技术实现类似目标的框架?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个需要以有组织的方式存储大量记录的应用程序。具体来说,我写一个个人理财应用程序。你可以想象,这个应用程序将包含金融交易的记录,必须以各种方式排序:按日期,金额,收件人,帐户等。当然,应用程序需要快速得到,说,所有

I'm developing an application that needs to store lots of records in an organized way. Specifically, I'm writing a personal finance app. As you can imagine, this app will contain records of financial transactions that must be sorted in various ways: by date, by amounts, by recipient, by account, etc. And of course, the app will need to quickly get, say, all transactions between certain dates, quickly sum up some records, and so forth.

我仍然在设计阶段,我打算使用SQLite作为后端存储为应用程序,因为OS X已经附带一个SQLite框架。我想自己,抽象出数据库连接层,以便我可以重用其他项目中的代码,然后我认为可能有人可能已经做了这个。可能很好。

I'm still in the design phase, and I'm planning to use SQLite as the backend storage for the app, since OS X already ships with a SQLite framework. I thought to myself that it might be nice to abstract out the database-connection layer so that I may re-use the code in other projects, and then I thought that maybe someone else may have already done this.

然后我认为这可能不是一个好主意。我已经阅读了一点关于CoreData在OS X,并认为也许我应该使用CoreData为此目的。然而,我不知道CoreData是否真的符合我的目标。它似乎更像是抽象出一个应用程序的控制器,并将UI小部件绑定到模型,而不是提供一个API,使其快速和容易运行可能复杂的查询结构化数据。

Then I thought it might not be a good idea at all. I've read a little bit about CoreData on OS X, and thought that maybe I should be using CoreData for this purpose. However, I don't know if CoreData really fits my goals. It seems more like a way to abstract out an app's controllers and tie UI widgets to models, rather than providing an API to make it fast and easy to run possibly complicated queries on structured data.

所以我的问题是三个相关的部分:

So my question is really three related parts:


  1. Cocoa有ORM吗?我正在寻找像Django的ORM层,或Rails的ActiveRecord。 (我只需要它连接到SQLite数据库,尽管。)

  2. 或者我应该使用CoreData为此?

  3. 或者我是在歪曲错误的树,而应该使用另一种方法来实现我的目标?
  1. Is there an ORM for Cocoa? I'm looking for something like Django's ORM layer, or Rails' ActiveRecord. (I only need it to connect to SQLite databases, though.)
  2. Or should I just use CoreData for this? Will it fit my needs well?
  3. Or am I barking up the wrong tree, and should be looking at another framework that accomplishes my goals with a different technique?


推荐答案


Cocoa有ORM吗?我正在寻找
像Django的ORM层,
或Rails的ActiveRecord。 (我只需要
它连接到SQLite数据库,
虽然。)

Is there an ORM for Cocoa? I'm looking for something like Django's ORM layer, or Rails' ActiveRecord. (I only need it to connect to SQLite databases, though.)

技术上,没有。


或者我应该使用CoreData for
吗?

Or should I just use CoreData for this? Will it fit my needs well?

你可以尝试,但CoreData不太适合我。 CoreData有一些ORM类似的功能,但不是一个真正的ORM。

You can try, but CoreData is not likely a good fit. CoreData has some ORM like features, but is not really an ORM.


或者我咆哮错误的树,
应该看到另一个框架
使用
不同的技术来实现我的目标?

Or am I barking up the wrong tree, and should be looking at another framework that accomplishes my goals with a different technique?

但没有什么可以接近原生Cocoa ORM。一个这样的选择是使用Java ORM,如Hibernate,然后你从你的Cocoa代码调用。

There are alternatives, but nothing that approaches a native Cocoa ORM. One such option is to use a Java ORM like Hibernate which you then call from your Cocoa code.

在现实中,你不需要一个ORM。你可以在OSX SQLLite框架之上构建一个简单的ORM。如果你打开你的简单的ORM,这个问题会有一个更好的答案。 :)

In reality, you don't need an ORM. You could build a simplistic ORM yourself on top of the OSX SQLLite framework. If you then open sourced your simplistic ORM, this question would have a better answer. :)

这篇关于有Cocoa的ORM框架,或使用不同的技术实现类似目标的框架?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆