private void ReadEntities() { if (_reader.LocalName == "entities") { string elem = ReadNextElement(); while (elem == "entity") { var id = ReadId("id"); var deleted = ReadAttribute("deleted", false); if (deleted == "true") { var cmd = new Hyperstore.Modeling.Commands.RemoveEntityCommand(_domain, id, false); Session.Current.Execute(cmd); elem = ReadNextElement(); continue; } var metadata = ReadAttribute("schema"); var schema = GetSchemaFromMoniker(metadata) as ISchemaEntity; if (schema == null) { throw new MetadataNotFoundException(String.Format("Invalid metadata {0} for entity {1}", metadata, id)); } IModelEntity entity = null; if (_allowElementOverriding) { entity = _domain.GetEntity(id); } if (entity == null) { entity = _domain.CreateEntity(schema, id); } elem = ReadProperties(entity, schema); } } }