private void ProcessProperty( IPreprocessorEntity <TEntity> entity, ReferenceIdentifierProperty property) { EntityIdentifier sourceSystemEntityId = this.entityIdentifierConverter.FromValue( property.SourceSystemIdentifierProperty.GetValue(entity.Entity)); if (sourceSystemEntityId != null) { EntityIdentifier destinationSystemEntityId = this.GetDestinationSystemEntityId( property.ReferencedEntityType, sourceSystemEntityId, property.DestinationSystemIdentifierProperty.Name); if (destinationSystemEntityId != null) { object typedDestinationSystemEntityId = this.entityIdentifierConverter.ToValue( destinationSystemEntityId, property.DestinationSystemIdentifierProperty.PropertyType); property.DestinationSystemIdentifierProperty.SetValue( entity.Entity, typedDestinationSystemEntityId); } else { throw new ReferenceIdentifierResolverException( string.Format( Resources.UnableToResolveReferenceIdentifier, property.DestinationSystemIdentifierProperty.Name, sourceSystemEntityId), this.ShouldRejectEntity(entity, property)); } } }
private bool ShouldRejectEntity( IPreprocessorEntity <TEntity> entity, ReferenceIdentifierProperty property) { return ((entity.MappingExists == false && property.IsRequiredOnCreation) || (entity.MappingExists == true && property.IsRequiredOnUpdate)); }