/// <summary>
        /// Patch changes
        /// </summary>
        /// <param name="source"></param>
        /// <param name="target"></param>
        public static void Patch(this dataModel.PropertyValue source, dataModel.PropertyValue target)
        {
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }


            var patchInjectionPolicy = new PatchInjection <dataModel.PropertyValue>(x => x.BooleanValue, x => x.DateTimeValue,
                                                                                    x => x.DecimalValue, x => x.IntegerValue,
                                                                                    x => x.KeyValue, x => x.LongTextValue, x => x.ShortTextValue);

            target.InjectFrom(patchInjectionPolicy, source);
        }
        /// <summary>
        /// Converting to foundation type
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="propValue">The property value.</param>
        /// <returns></returns>
        /// <exception cref="System.ArgumentNullException">propValue</exception>
        public static dataModel.PropertyValue ToDataModel(this coreModel.PropertyValue propValue, PrimaryKeyResolvingMap pkMap) 
        {
            if (propValue == null)
                throw new ArgumentNullException("propValue");

            var retVal = new dataModel.PropertyValue();
            pkMap.AddPair(propValue, retVal);
            retVal.InjectFrom(propValue);
   
            retVal.Name = propValue.PropertyName;
            retVal.KeyValue = propValue.ValueId;
            retVal.Locale = propValue.LanguageCode;
            retVal.ValueType = (int)propValue.ValueType;
            SetPropertyValue(retVal, propValue.ValueType, propValue.Value.ToString());

            return retVal;
        }
        /// <summary>
        /// Converting to foundation type
        /// </summary>
        /// <param name="catalog"></param>
        /// <returns></returns>
        public static dataModel.PropertyValue ToDataModel(this coreModel.PropertyDictionaryValue propDictValue, coreModel.Property property)
        {
            var retVal = new dataModel.PropertyValue
            {
	            Locale = propDictValue.LanguageCode,
                PropertyId = property.Id
            };
			retVal.InjectFrom(propDictValue);

			if(propDictValue.Id != null)
			{
				retVal.Id = propDictValue.Id;
			}
            SetPropertyValue(retVal, property.ValueType, propDictValue.Value);

            return retVal;
        }
示例#4
0
        /// <summary>
        /// Converting to foundation type
        /// </summary>
        /// <param name="catalog"></param>
        /// <returns></returns>
        public static dataModel.PropertyValue ToDataModel(this coreModel.PropertyDictionaryValue propDictValue, coreModel.Property property)
        {
            var retVal = new dataModel.PropertyValue
            {
                Locale     = propDictValue.LanguageCode,
                PropertyId = property.Id
            };

            retVal.InjectFrom(propDictValue);

            if (propDictValue.Id != null)
            {
                retVal.Id = propDictValue.Id;
            }
            SetPropertyValue(retVal, property.ValueType, propDictValue.Value);

            return(retVal);
        }
        /// <summary>
        /// Converting to foundation type
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="propValue">The property value.</param>
        /// <returns></returns>
        /// <exception cref="System.ArgumentNullException">propValue</exception>
        public static dataModel.PropertyValue ToDataModel(this coreModel.PropertyValue propValue, PrimaryKeyResolvingMap pkMap)
        {
            if (propValue == null)
            {
                throw new ArgumentNullException("propValue");
            }

            var retVal = new dataModel.PropertyValue();

            pkMap.AddPair(propValue, retVal);
            retVal.InjectFrom(propValue);

            retVal.Name      = propValue.PropertyName;
            retVal.KeyValue  = propValue.ValueId;
            retVal.Locale    = propValue.LanguageCode;
            retVal.ValueType = (int)propValue.ValueType;
            SetPropertyValue(retVal, propValue.ValueType, propValue.Value.ToString());

            return(retVal);
        }