//public virtual ObservableCollection<DynamicPropertyObjectValueEntity> ObjectValues { get; set; } public virtual DynamicProperty ToModel(DynamicProperty dynamicProp) { if (dynamicProp == null) { throw new ArgumentNullException(nameof(dynamicProp)); } dynamicProp.Id = Id; dynamicProp.CreatedBy = CreatedBy; dynamicProp.CreatedDate = CreatedDate; dynamicProp.ModifiedBy = ModifiedBy; dynamicProp.ModifiedDate = ModifiedDate; dynamicProp.Description = Description; dynamicProp.DisplayOrder = DisplayOrder; dynamicProp.IsArray = IsArray; dynamicProp.IsDictionary = IsDictionary; dynamicProp.IsMultilingual = IsMultilingual; dynamicProp.IsRequired = IsRequired; dynamicProp.Name = Name; dynamicProp.ObjectType = ObjectType; dynamicProp.ValueType = EnumUtility.SafeParse(ValueType, DynamicPropertyValueType.LongText); dynamicProp.DisplayNames = DisplayNames.Select(x => x.ToModel(AbstractTypeFactory <DynamicPropertyName> .TryCreateInstance())).ToArray(); //if (dynamicProp is DynamicObjectProperty dynamicObjectProp) //{ // dynamicObjectProp.Values = ObjectValues.Select(x => x.ToModel(AbstractTypeFactory<DynamicPropertyObjectValue>.TryCreateInstance())).ToArray(); //} return(dynamicProp); }
public virtual object Clone() { var result = MemberwiseClone() as Property; if (Attributes != null) { result.Attributes = Attributes.Select(x => x.Clone()).OfType <PropertyAttribute>().ToList(); } if (DictionaryValues != null) { result.DictionaryValues = DictionaryValues.Select(x => x.Clone()).OfType <PropertyDictionaryValue>().ToList(); } if (DisplayNames != null) { result.DisplayNames = DisplayNames.Select(x => x.Clone()).OfType <PropertyDisplayName>().ToList(); } if (ValidationRules != null) { result.ValidationRules = ValidationRules.Select(x => x.Clone()).OfType <PropertyValidationRule>().ToList(); } if (Values != null) { result.Values = Values.Select(x => x.Clone()).OfType <PropertyValue>().ToList(); } return(result); }
public virtual DynamicPropertyDictionaryItem ToModel(DynamicPropertyDictionaryItem dictItem) { if (dictItem == null) { throw new ArgumentNullException(nameof(dictItem)); } dictItem.PropertyId = PropertyId; dictItem.Name = Name; dictItem.DisplayNames = DisplayNames.Select(x => x.ToModel(AbstractTypeFactory <DynamicPropertyDictionaryItemName> .TryCreateInstance())).ToArray(); return(dictItem); }
public virtual Property ToModel(Property property) { if (property == null) { throw new ArgumentNullException(nameof(property)); } property.Id = Id; property.CreatedBy = CreatedBy; property.CreatedDate = CreatedDate; property.ModifiedBy = ModifiedBy; property.ModifiedDate = ModifiedDate; property.CatalogId = CatalogId; property.CategoryId = CategoryId; property.Name = Name; property.Required = IsRequired; property.Multivalue = IsMultiValue; property.Multilanguage = IsLocaleDependant; property.Dictionary = IsEnum; property.Hidden = IsHidden; property.ValueType = (PropertyValueType)PropertyValueType; property.Type = EnumUtility.SafeParse(TargetType, PropertyType.Catalog); property.Attributes = PropertyAttributes.Select(x => x.ToModel(AbstractTypeFactory <PropertyAttribute> .TryCreateInstance())).ToList(); property.DisplayNames = DisplayNames.Select(x => x.ToModel(AbstractTypeFactory <PropertyDisplayName> .TryCreateInstance())).ToList(); property.ValidationRules = ValidationRules.Select(x => x.ToModel(AbstractTypeFactory <PropertyValidationRule> .TryCreateInstance())).ToList(); foreach (var rule in property.ValidationRules) { rule.Property = property; } return(property); }