Is CoreData typically used as a model, or is it a detail of infrastructure infrastructure?

I would like to use the Sqlite database in iphone application. The example in the book I'm reading has controllers that directly call CoreData objects.

Moving from MVC / MVP in .NET to me is akin to opening an SQL connection in a button event handler. Usually I had a repository that handled the details of getting / saving the model.

1) Is it normal to use CoreData functions directly in the controller?

2) Is extracting my domain model into separate classes, which translate back and forth to a persistence level, not a good idea on the iPhone (in terms of performance, memory, expected project organization, etc.)?

3) Will creating a repository layer work well on an iPhone?

Moving from the SmallTalk Objective-C background and the MVC approach to iPhone applications, I expected to use domain models, repositories, IoC, etc.

This is just unreal? Is the author and I just on different pages? Thanks for any input.

+3
source share
2 answers

The iPhone SDK implements the MVC pattern, but also many others (delegate). So it may not be as strict as the other languages ​​you spoke about. To answer your questions:

  • - . , MVC. CoreData Framework. , , DAO, ActiveRecord ..

  • Model (Model.m/h), . CoreData .

  • .NET, , , , .

, , . ADC, - CoreDataBooks.

+2

, . , , . Core Data - - () sqlite, sqlite. , , - .

+2

Source: https://habr.com/ru/post/1751915/


All Articles