Re: A question about core data.
Re: A question about core data.
- Subject: Re: A question about core data.
- From: Felix Franz <email@hidden>
- Date: Thu, 12 Apr 2012 11:43:16 +0200
Hello Michael,
On 11.04.2012, at 00:18, Michael Parchet wrote:
> Hello,
>
> I have started a billing project with coco and core data. In my project, I have a form that the user must fill to add a customer (for example) but it seems that core data have only an array controller with a manage object context to manage the core data database. Is it true ?
no. You don't have to use a NSArrayController.
>
> In some language (such as java), I can send some sql query to the database. such as (insert into Customeer etc..), I can also send a set of query (transaction).
>
> On the apple website, in a guide, I have reed an information about fetch request How it work ? Can the fetch request help me in my project ?
CoreData is a complex technology, if you don't already read the Core Data Programming Guide https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CoreData/cdProgrammingGuide.html#//apple_ref/doc/uid/TP40001075
now is the time to do so …
For example your example "insert a Customer":
context is a NSManagedObjectContext, "Customer" your Customer entity
NSManagedObject *customer = [NSEntityDescription
insertNewObjectForEntityForName:@"Customer"
inManagedObjectContext:context];
that's all. After that you use the customer. On context>>save: the new customer is written to disk (if you don't use a in memory
persistent store…).
A fetch request fetches as the name implies … CoreData is not a ORM-framework. sqlite is available as a persistent store type,
but you can't access the database directly.
Cheers,
Felix
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden