Database Reference
In-Depth Information
when we start scaling it to half a dozen or more clients, it starts to slow
down very quickly. There are optimizations that we can do, but if you
have more than a couple of clients, it's better to use a full database solu-
tion instead of Core Data.
Threading : Although all the calls to the server are performed on the main
thread, calls within objects passed by reference are not by their very
nature. Therefore, if we pass an NSManagedObject by reference to a client
and that client makes a change to the NSManagedObject , we are in a worst-
case situation with regard to threading.
11.1
Building the Server
In a normal client-server application, the server would be a background or
GUI-less application. In this demonstration, we are going to start with a normal
single persistent store Cocoa application instead. There is no benefit to having
a UI for a server in a production environment, but for testing, it is useful to
see the activity on the server. Therefore, we start with creating a Core Data
Cocoa application called DistributedCDServer. The user interface for the
server is a single window with a table view displaying the list of items in the
Core Data persistent store, as shown here:
The data model for this example is composed of two entities. The top-level
entity is named Test and has two properties: name and children . The second
entity is called Child and also has two properties: name and parent . The two
 
 
Search WWH ::




Custom Search