public ArchetypePublishedProperty(ArchetypePropertyModel property) { if (property == null) { throw new ArgumentNullException("property"); } var preview = false; _property = property; _rawValue = property.Value; // #418 - need to wrap this in a try/catch to prevent orphaned properties from breaking everything try { _propertyType = property.CreateDummyPropertyType(); if (_propertyType != null) { _sourceValue = new Lazy <object>(() => _propertyType.ConvertDataToSource(_rawValue, preview)); _objectValue = new Lazy <object>(() => _propertyType.ConvertSourceToObject(_sourceValue.Value, preview)); _xpathValue = new Lazy <object>(() => _propertyType.ConvertSourceToXPath(_sourceValue.Value, preview)); } } catch (Exception ex) { LogHelper.Warn <ArchetypePublishedProperty>(string.Format("Could not create an IPublishedProperty for property: {0} - the error was: {1}", property.Alias, ex.Message)); } }
public ArchetypePublishedProperty(ArchetypePropertyModel property) { if (property == null) { throw new ArgumentNullException("property"); } var preview = false; _property = property; _rawValue = property.Value; _propertyType = property.CreateDummyPropertyType(); if (_propertyType != null) { _sourceValue = new Lazy <object>(() => _propertyType.ConvertDataToSource(_rawValue, preview)); _objectValue = new Lazy <object>(() => _propertyType.ConvertSourceToObject(_sourceValue.Value, preview)); _xpathValue = new Lazy <object>(() => _propertyType.ConvertSourceToXPath(_sourceValue.Value, preview)); } }