Inherits from: NSObject
Conforms to: NSObject
(NSObject)
Declared in: EOAccess/EOModel.h
An EOModel represents a mapping between a database schema and a set of classes based on the entity-relationship model. The model contains a number of EOEntity objects representing the entities (tables) of the database schema. Each EOEntity object has a number of EOAttribute and EORelationship objects representing the properties (columns or fields) of the entity in the database schema. For more information on attributes and relationships, see their respective class specifications.
An EOModel maintains a mapping between each of its EOEntity objects and a corresponding enterprise object class for use with the database level of the Enterprise Objects Framework. You can determine the EOEntity for a particular enterprise object with the entityForObject: method.
An EOModel is specific to a particular database server, and stores information needed to connect to that server. This includes the name of an adaptor framework to load so that the Enterprise Objects Framework can communicate with the database. Models are stored in the file system in a manner similar to adaptor framework. EOModel objects are usually loaded from model files built with the EOModeler application rather than built programmatically. If you need to programmatically load a model file, see the section "Loading a Model File" .
Models can have relationships that reference other models in the same model group. The other models may map to different databases and types of servers.
Models are organized into model groups; see the EOModelGroup class specification for more information.
The EOAdaptorChannel class declares methods for reading basic schema information from a relational database. You can use this information to build up an EOModel programmatically, and then enhance that model by defining extra relationships, flattening attributes, and so on. See the class description in the EOAdaptorChannel class specification for information on reading basic schema information, and see the other modeling classes' specifications for information on creating additional attributes and relationships.
In EOModel.h, EOModelEOAccess defines an NSString constant for the name of the notification it posts. For more information, see "Notifications" .
- Initializing an EOModel instance
- - initWithContentsOfFile:
- - initWithTableOfContentsPropertyList:path:
- Saving a model
- - encodeTableOfContentsIntoPropertyList:
- - writeToFile:
- Loading a model's objects
- - loadAllModelObjects
- Working with entities
- - addEntity:
- - removeEntity:
- - removeEntityAndReferences:
- - entityNames
- - entityNamed:
- - entities
- - entitiesWithSharedObjects
- Naming a model's components
- - beautifyNames
- Accessing the model's name
- - setName:
- - name
- - path
- Checking references
- - referencesToProperty:
- - externalModelsReferenced
- Getting an object's entity
- - entityForObject:
- Accessing the adaptor bundle
- - adaptorName
- - setAdaptorName:
- Accessing the connection dictionary
- - setConnectionDictionary:
- - connectionDictionary
- Accessing the user dictionary
- - setUserInfo:
- - userInfo
- Working with stored procedures
- - addStoredProcedure:
- - removeStoredProcedure:
- - storedProcedureNames
- - storedProcedureNamed:
- - storedProcedures
- Accessing the model's group
- - setModelGroup:
- - modelGroup
- Accessing prototype attributes
- - availablePrototypeAttributeNames
- - prototypeAttributeNamed:
- (NSString *)adaptorName
- (void)addEntity:(EOEntity
*)anEntity
NSInvalidArgumentException
if
an error occurs (for example, if anEntity doesn't
exist, if the entity belongs to another model, or if an entity of
the same name is already in the receiver).See Also: - entities, - removeEntity:, - removeEntityAndReferences:
- (void)addStoredProcedure:(EOStoredProcedure
*)storedProcedure
NSInvalidArgumentException
if
an error occurs (for example, if a stored procedure of the same
name is already in the receiver).See Also: - removeStoredProcedure:, - storedProcedures, - storedProcedureNamed:, - storedProcedureNames
- (NSArray *)availablePrototypeAttributeNames
See Also: - prototypeAttributeNamed:
- (void)beautifyNames
See Also: + externalNameForInternalName:separatorString:useAllCaps: (NSString Additions), - beautifyName ( EOEntity, EOAttribute, EORelationship, EOStoredProcedure), - name
- (NSDictionary *)connectionDictionary
- (void)encodeTableOfContentsIntoPropertyList:(NSMutableDictionary
*)propertyList
See Also: - initWithTableOfContentsPropertyList:path:
- (NSArray *)entities
See Also: - entityNames
- (NSArray *)entitiesWithSharedObjects
- (EOEntity *)entityForObject:(id)anEO
- (EOEntity *)entityNamed:(NSString
*)name
See Also: - entityNames, - entities
- (NSArray *)entityNames
See Also: - entities, - entityNamed:
- (NSArray *)externalModelsReferenced
See Also: - referencesToProperty:
- initWithContentsOfFile:(NSString
*)path
NSInvalidArgumentException
if
for any reason it cannot initialize the model from the file specified
by path.- initWithTableOfContentsPropertyList:(NSDictionary
*)tableOfContents path:(NSString
*)path
See Also: - encodeTableOfContentsIntoPropertyList:
- (void)loadAllModelObjects
See Also: - attributes (EOEntity), - entities, - relationships (EOEntity), - storedProcedures
- (EOModelGroup *)modelGroup
See Also: - setModelGroup:
- (NSString *)name
See Also: - path, - initWithTableOfContentsPropertyList:path:
- (NSString *)path
See Also: - name - initWithContentsOfFile:
- (EOAttribute *)prototypeAttributeNamed:(NSString
*)attributeName
See Also: - availablePrototypeAttributeNames
- (NSArray *)referencesToProperty:(id)aProperty
See Also: - externalModelsReferenced
- (void)removeEntity:(EOEntity
*)name
See Also: - addEntity:, - removeEntityAndReferences:
- (void)removeEntityAndReferences:(EOEntity
*)entity
See Also: - removeEntity:, - addEntity:
- (void)removeStoredProcedure:(EOStoredProcedure
*)storedProcedure
See Also: - addStoredProcedure:, - storedProcedures
- (void)setAdaptorName:(NSString
*)adaptorName
See Also: + availableAdaptorNames (EOAdaptor)
- (void)setConnectionDictionary:(NSDictionary
*)connectionDictionary
See Also: adaptorWithModel: (EOAdaptor)
- (void)setModelGroup:(EOModelGroup
*)group
See Also: - modelGroup
- (void)setName:(NSString
*)name
- (void)setUserInfo:(NSDictionary
*)dictionary
- (EOStoredProcedure *)storedProcedureNamed:(NSString
*)name
See Also: - storedProcedureNames, - storedProcedures
- (NSArray *)storedProcedureNames
See Also: - storedProcedureNamed:, - storedProcedures
- (NSArray *)storedProcedures
See Also: - storedProcedureNames, - storedProcedureNamed:
- (NSDictionary *)userInfo
See Also: - setUserInfo:
- (void)writeToFile:(NSString
*)path
Raises an NSInvalidArgumentException
on
any error which prevents the file from being written.
See Also: - path
EOModel declares and posts the following notification.
Notification Object | The entity that was loaded. |
Userinfo | None |