Table of Contents Previous Section
Specifying an Enterprise Object Class
Specifying an enterprise object class for an entity applies the mapping defined in your model to your custom class, thereby enabling objects of the class to be created from database rows.To specify the enterprise object class for an entity:
- Make sure that each of the properties you want to include in your enterprise object class has a Class Property icon set for it in the Inspector.
- If the entity does not already have a primary key specified, add a Primary Key icon for the property or properties that constitute the entity's primary key.
Remember that the primary key or keys you set for your enterprise object class must mirror the primary key or keys defined for the corresponding table in the database.
You can use either of the following approaches, depending on the needs of your application:
- Use EOGenericRecord.
- Create a custom class that uses the default implementation of key-value coding. If you plan to create a custom class, you must type its name in the Class field.
If you don't edit the Class field to specify a name for a custom class, the Framework uses EOGenericRecord as an enterprise object class by default. A generic record uses a dictionary to store key-value pairs that correspond to an entity's properties and the data associated with each property. Use EOGenericRecord when you don't need to define special behavior for your class.
Table of Contents Next Section