コード例 #1
0
        public static void MapAttributeTypeDefinition(Model.Attribution.MetaData.AttributeType source, AttributeType destination, AbstractLookupHelper lookupHelper, AbstractMappingEngine masterMapper)
        {
            destination.Id = (Guid)source.Id.Value;

            destination.Alias = source.Alias ?? StringExtensions.ToUmbracoAlias(source.Name);

            var attributeSerializationDefinition = source.SerializationType;

            if (attributeSerializationDefinition == null)
            {
                LogHelper.Warn(typeof(ModelToRdbmsMapper), ("source.SerializationType is null for AttributeType Id {0} and Alias {1}"), source.Id, source.Alias);
                return;
            }
            destination.PersistenceTypeProvider = attributeSerializationDefinition.GetType().AssemblyQualifiedName;

            //sets the values if it is dirty
            destination.TrySetPropertyFromDirty(toProp => toProp.Alias, source, fromProp => fromProp.Alias, () => source.Alias ?? StringExtensions.ToUmbracoAlias(source.Name));
            destination.TrySetPropertyFromDirty(toProp => toProp.Description, source, fromProp => fromProp.Description, () => (string)source.Description);
            destination.TrySetPropertyFromDirty(toProp => toProp.Name, source, fromProp => fromProp.Name, () => (string)source.Name);
            destination.TrySetPropertyFromDirty(toProp => toProp.RenderTypeProvider, source, fromProp => fromProp.RenderTypeProvider);
            destination.TrySetPropertyFromDirty(toProp => toProp.XmlConfiguration, source, fromProp => fromProp.RenderTypeProviderConfig);
        }