EOModel
Inherits from: NSObject
Conforms to: NSObject
(NSObject)
Declared in: EOAccess/EOModel.h
Class Description
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.
Creating an EOModel Programmatically
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.
Constants
In EOModel.h, EOModelEOAccess defines an NSString constant for the name of the notification it posts. For more information, see "Notifications" .
Method Types
- 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:
Instance Methods
adaptorName
- (NSString *)adaptorName
addEntity:
- (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:
addStoredProcedure:
- (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
availablePrototypeAttributeNames
- (NSArray *)availablePrototypeAttributeNames
See Also: - prototypeAttributeNamed:
beautifyNames
- (void)beautifyNames
See Also: + externalNameForInternalName:separatorString:useAllCaps: (NSString Additions), - beautifyName ( EOEntity, EOAttribute, EORelationship, EOStoredProcedure), - name
connectionDictionary
- (NSDictionary *)connectionDictionary
encodeTableOfContentsIntoPropertyList:
- (void)encodeTableOfContentsIntoPropertyList:(NSMutableDictionary
*)propertyList
See Also: - initWithTableOfContentsPropertyList:path:
entities
- (NSArray *)entities
See Also: - entityNames
entitiesWithSharedObjects
- (NSArray *)entitiesWithSharedObjects
entityForObject:
- (EOEntity *)entityForObject:(id)anEO
entityNamed:
- (EOEntity *)entityNamed:(NSString
*)name
See Also: - entityNames, - entities
entityNames
- (NSArray *)entityNames
See Also: - entities, - entityNamed:
externalModelsReferenced
- (NSArray *)externalModelsReferenced
See Also: - referencesToProperty:
initWithContentsOfFile:
- initWithContentsOfFile:(NSString
*)path
NSInvalidArgumentException
if
for any reason it cannot initialize the model from the file specified
by path.initWithTableOfContentsPropertyList:path:
- initWithTableOfContentsPropertyList:(NSDictionary
*)tableOfContents path:(NSString
*)path
See Also: - encodeTableOfContentsIntoPropertyList:
loadAllModelObjects
- (void)loadAllModelObjects
See Also: - attributes (EOEntity), - entities, - relationships (EOEntity), - storedProcedures
modelGroup
- (EOModelGroup *)modelGroup
See Also: - setModelGroup:
name
- (NSString *)name
See Also: - path, - initWithTableOfContentsPropertyList:path:
path
- (NSString *)path
See Also: - name - initWithContentsOfFile:
prototypeAttributeNamed:
- (EOAttribute *)prototypeAttributeNamed:(NSString
*)attributeName
See Also: - availablePrototypeAttributeNames
referencesToProperty:
- (NSArray *)referencesToProperty:(id)aProperty
See Also: - externalModelsReferenced
removeEntity:
- (void)removeEntity:(EOEntity
*)name
See Also: - addEntity:, - removeEntityAndReferences:
removeEntityAndReferences:
- (void)removeEntityAndReferences:(EOEntity
*)entity
See Also: - removeEntity:, - addEntity:
removeStoredProcedure:
- (void)removeStoredProcedure:(EOStoredProcedure
*)storedProcedure
See Also: - addStoredProcedure:, - storedProcedures
setAdaptorName:
- (void)setAdaptorName:(NSString
*)adaptorName
See Also: + availableAdaptorNames (EOAdaptor)
setConnectionDictionary:
- (void)setConnectionDictionary:(NSDictionary
*)connectionDictionary
See Also: adaptorWithModel: (EOAdaptor)
setModelGroup:
- (void)setModelGroup:(EOModelGroup
*)group
See Also: - modelGroup
setName:
- (void)setName:(NSString
*)name
setUserInfo:
- (void)setUserInfo:(NSDictionary
*)dictionary
storedProcedureNamed:
- (EOStoredProcedure *)storedProcedureNamed:(NSString
*)name
See Also: - storedProcedureNames, - storedProcedures
storedProcedureNames
- (NSArray *)storedProcedureNames
See Also: - storedProcedureNamed:, - storedProcedures
storedProcedures
- (NSArray *)storedProcedures
See Also: - storedProcedureNames, - storedProcedureNamed:
userInfo
- (NSDictionary *)userInfo
See Also: - setUserInfo:
writeToFile:
- (void)writeToFile:(NSString
*)path
Raises an NSInvalidArgumentException
on
any error which prevents the file from being written.
See Also: - path
Notifications
EOModel declares and posts the following notification.
EOEntityLoadedNotification
Posted after an EOEntity is loaded into memory. The notification contains:Notification Object | The entity that was loaded. |
Userinfo | None |