Inherits from | |
Conforms to | |
Framework | /System/Library/Frameworks/CoreData.framework |
Availability | Available in Mac OS X v10.5 and later. |
Companion guide | |
Declared in | NSEntityMapping.h |
Instances of NSEntityMapping
specify how to map an entity from a source to a destination managed object model.
– sourceEntityName
– setSourceEntityName:
– sourceEntityVersionHash
– setSourceEntityVersionHash:
– sourceExpression
– setSourceExpression:
– destinationEntityName
– setDestinationEntityName:
– destinationEntityVersionHash
– setDestinationEntityVersionHash:
Returns the array of attribute mappings for the receiver.
- (NSArray *)attributeMappings
The array of attribute mappings for the receiver.
The order of mappings in the array specifies the order in which the mappings will be processed during a migration.
NSEntityMapping.h
Returns the destination entity name for the receiver.
- (NSString *)destinationEntityName
The destination entity name for the receiver.
Mappings are not directly bound to entity descriptions. You can use the migration manager’s destinationEntityForEntityMapping:
method to retrieve the entity description for this entity name.
NSEntityMapping.h
Returns the version hash for the destination entity for the receiver.
- (NSData *)destinationEntityVersionHash
The version hash for the destination entity for the receiver.
The version hash is calculated by Core Data based on the property values of the entity (see NSEntityDescription
’s versionHash
method). The destinationEntityVersionHash
must equal the version hash of the destination entity represented by the mapping.
NSEntityMapping.h
Returns the class name of the migration policy for the receiver.
- (NSString *)entityMigrationPolicyClassName
The class name of the migration policy for the receiver.
If not specified, the default migration class name is NSEntityMigrationPolicy
. You can specify a subclass to provide custom behavior.
NSEntityMapping.h
Returns the mapping type for the receiver.
- (NSEntityMappingType)mappingType
The mapping type for the receiver.
NSEntityMapping.h
Returns the name of the receiver.
- (NSString *)name
The name of the receiver.
The name is used only as a means of distinguishing mappings in a model. If not specified, the value defaults to SOURCE->DESTINATION.
NSEntityMapping.h
Returns the array of relationship mappings for the receiver.
- (NSArray *)relationshipMappings
The array of relationship mappings for the receiver.
The order of mappings in the array specifies the order in which the mappings will be processed during a migration.
NSEntityMapping.h
Sets the array of attribute mappings for the receiver.
- (void)setAttributeMappings:(NSArray *)mappings
The array of attribute mappings for the receiver.
NSEntityMapping.h
Sets the destination entity name for the receiver.
- (void)setDestinationEntityName:(NSString *)name
The destination entity name.
NSEntityMapping.h
Sets the version hash for the destination entity for the receiver.
- (void)setDestinationEntityVersionHash:(NSData *)vhash
The version hash for the destination entity.
NSEntityMapping.h
Sets the class name of the migration policy for the receiver.
- (void)setEntityMigrationPolicyClassName:(NSString *)name
The class name of the migration policy (either NSEntityMigrationPolicy
or a subclass of NSEntityMigrationPolicy
).
NSEntityMapping.h
Sets the mapping type for the receiver.
- (void)setMappingType:(NSEntityMappingType)type
The mapping type for the receiver.
If you specify a custom entity mapping type, you must specify a value for the migration policy class name as well (see setEntityMigrationPolicyClassName:
).
NSEntityMapping.h
Sets the name of the receiver.
- (void)setName:(NSString *)name
The name of the receiver.
NSEntityMapping.h
Sets the array of relationship mappings for the receiver.
- (void)setRelationshipMappings:(NSArray *)mappings
The array of relationship mappings for the receiver.
NSEntityMapping.h
Sets the source entity name for the receiver.
- (void)setSourceEntityName:(NSString *)name
The source entity name for the receiver.
NSEntityMapping.h
Sets the version hash for the source entity for the receiver.
- (void)setSourceEntityVersionHash:(NSData *)vhash
The version hash for the source entity for the receiver.
NSEntityMapping.h
Sets the source expression for the receiver.
- (void)setSourceExpression:(NSExpression *)source
The source expression for the receiver. The expression can be a fetch request expression, or any other expression which evaluates to a collection.
NSEntityMapping.h
Sets the user info dictionary for the receiver.
- (void)setUserInfo:(NSDictionary *)dict
The user info dictionary for the receiver.
You can set the contents of the dictionary using the appropriate inspector in the Xcode mapping model editor.
NSEntityMapping.h
Returns the source entity name for the receiver.
- (NSString *)sourceEntityName
The source entity name for the receiver.
Mappings are not directly bound to entity descriptions; you can use the sourceEntityForEntityMapping:
method on the migration manager to retrieve the entity description for this entity name.
NSEntityMapping.h
Returns the version hash for the source entity for the receiver.
- (NSData *)sourceEntityVersionHash
The version hash for the source entity for the receiver.
The version hash is calculated by Core Data based on the property values of the entity (see NSEntityDescription
’s versionHash
method). The sourceEntityVersionHash
must equal the version hash of the source entity represented by the mapping.
NSEntityMapping.h
Returns the source expression for the receiver.
- (NSExpression *)sourceExpression
The source expression. The expression can be a fetch request expression, or any other expression which evaluates to a collection.
The source expression is used to obtain the collection of managed objects to process through the mapping.
NSEntityMapping.h
Returns the user info dictionary for the receiver.
- (NSDictionary *)userInfo
The user info dictionary.
You can use the info dictionary in any way that might be useful in your migration. You set the contents of the dictionary using setUserInfo:
or using the appropriate inspector in the Xcode mapping model editor.
NSEntityMapping.h
These constants specify the types of entity mapping.
enum { NSUndefinedEntityMappingType = 0x00, NSCustomEntityMappingType = 0x01, NSAddEntityMappingType = 0x02, NSRemoveEntityMappingType = 0x03, NSCopyEntityMappingType = 0x04, NSTransformEntityMappingType = 0x05 };
NSUndefinedEntityMappingType
Specifies that the developer handles destination instance creation.
Available in Mac OS X v10.5 and later.
Declared in NSEntityMapping.h
.
NSCustomEntityMappingType
Specifies a custom mapping.
Available in Mac OS X v10.5 and later.
Declared in NSEntityMapping.h
.
NSAddEntityMappingType
Specifies that this is a new entity in the destination model.
Instances of the entity only exist in the destination.
Available in Mac OS X v10.5 and later.
Declared in NSEntityMapping.h
.
NSRemoveEntityMappingType
Specifies that this entity is not present in the destination model.
Instances of the entity only exist in the source—source instances are not mapped to destination.
Available in Mac OS X v10.5 and later.
Declared in NSEntityMapping.h
.
NSCopyEntityMappingType
Specifies that source instances are migrated as-is.
Available in Mac OS X v10.5 and later.
Declared in NSEntityMapping.h
.
NSTransformEntityMappingType
Specifies that entity exists in source and destination and is mapped.
Available in Mac OS X v10.5 and later.
Declared in NSEntityMapping.h
.
NSEntityMapping.h
Data type used for constants that specify types of entity mapping.
typedef NSUInteger NSEntityMappingType;
For possible values, see “Entity Mapping Types.”
NSEntityMapping.h
Last updated: 2009-02-19