Closed
Description
I guess it is OK, but one entity can only be used in a single MOM, otherwise it throws an internal inconsistency exception:
Can't use an entity in two models.
There is no really nice way around it, but internally MOMs are already uniqued based on the input types, so that is probably not a huge deal in practice.
Also, MOMs do not seem to go away when they are released. Or the entities keep a backref to them:
try autoreleasepool { // doesn't help
let schema1 = NSManagedObjectModel(
}
// Can't use an entity in two models. (NSInternalInconsistencyException)
let schema2 = NSManagedObjectModel(
[ Fixtures.PersonAddressSchema.Person.self ],
schemaCache: cache
)
Not sure there is a way around this. Entities could be copied, but they are likely still tied to the classes?