public DetachedPublishedProperty(PublishedPropertyType propertyType, object value, bool isPreview) { _propertyType = propertyType; _isPreview = isPreview; _rawValue = value; _sourceValue = new Lazy<object>(() => _propertyType.ConvertDataToSource(_rawValue, _isPreview)); _objectValue = new Lazy<object>(() => _propertyType.ConvertSourceToObject(_sourceValue.Value, _isPreview)); _xpathValue = new Lazy<object>(() => _propertyType.ConvertSourceToXPath(_sourceValue.Value, _isPreview)); }
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)); } }