예제 #1
0
 public virtual void Patch(DynamicPropertyDictionaryItemEntity target)
 {
     target.Name = Name;
     if (!DisplayNames.IsNullCollection())
     {
         var comparer = AnonymousComparer.Create((DynamicPropertyDictionaryItemNameEntity v) => string.Join("-", v.Locale, v.Name));
         DisplayNames.Patch(target.DisplayNames, comparer, (sourceItem, targetItem) => { });
     }
 }
        public static DynamicPropertyDictionaryItemEntity ToEntity(this DynamicPropertyDictionaryItem model, DynamicPropertyEntity property)
        {
            var result = new DynamicPropertyDictionaryItemEntity();
            result.InjectFrom(model);

            result.PropertyId = property.Id;

            if (model.DisplayNames != null)
                result.DisplayNames = new ObservableCollection<DynamicPropertyDictionaryItemNameEntity>(model.DisplayNames.Select(v => v.ToEntity()));

            return result;
        }
        public static void Patch(this DynamicPropertyDictionaryItemEntity source, DynamicPropertyDictionaryItemEntity target)
        {
            if (target == null)
                throw new ArgumentNullException("target");

            var patchInjectionPolicy = new PatchInjection<DynamicPropertyDictionaryItemEntity>(x => x.Name);
            target.InjectFrom(patchInjectionPolicy, source);

            if (!source.DisplayNames.IsNullCollection())
            {
                var comparer = AnonymousComparer.Create((DynamicPropertyDictionaryItemNameEntity v) => string.Join("-", v.Locale, v.Name));
                source.DisplayNames.Patch(target.DisplayNames, comparer, (sourceItem, targetItem) => { });
            }
        }