예제 #1
0
 /// <summary>
 /// Copies extra properties from the <paramref name="source"/> object
 /// to the <paramref name="destination"/> object.
 ///
 /// Checks property definitions (over the <see cref="ObjectExtensionManager"/>)
 /// based on the <paramref name="definitionChecks"/> preference.
 /// </summary>
 /// <typeparam name="TSource">Source class type</typeparam>
 /// <typeparam name="TDestination">Destination class type</typeparam>
 /// <param name="source">The source object</param>
 /// <param name="destination">The destination object</param>
 /// <param name="definitionChecks">
 ///     Controls which properties to map.
 /// </param>
 /// <param name="ignoredProperties">Used to ignore some properties</param>
 public static void MapExtraPropertiesTo <TSource, TDestination>(
     this TSource source,
     TDestination destination,
     MappingPropertyDefinitionChecks?definitionChecks = null,
     string[] ignoredProperties = null)
     where TSource : IHasExtraProperties
     where TDestination : IHasExtraProperties
 {
     ExtensibleObjectMapper.MapExtraPropertiesTo(
         source,
         destination,
         definitionChecks,
         ignoredProperties
         );
 }
예제 #2
0
        /// <summary>
        /// Copies extra properties from the <paramref name="source"/> object
        /// to the <paramref name="destination"/> object.
        ///
        /// Checks property definitions (over the <see cref="ObjectExtensionManager"/>)
        /// based on the <paramref name="definitionChecks"/> preference.
        /// </summary>
        /// <typeparam name="TSource">Source class type</typeparam>
        /// <typeparam name="TDestination">Destination class type</typeparam>
        /// <param name="source">The source object</param>
        /// <param name="destination">The destination object</param>
        /// <param name="definitionChecks">
        ///     Controls which properties to map.
        /// </param>
        /// <param name="ignoredProperties">Used to ignore some properties</param>
        public static void MapExtraPropertiesTo <TSource, TDestination>(
            TSource source,
            TDestination destination,
            MappingPropertyDefinitionChecks?definitionChecks = null,
            string[] ignoredProperties = null)
            where TSource : IHasExtraProperties
            where TDestination : IHasExtraProperties
        {
            Check.NotNull(source, nameof(source));
            Check.NotNull(destination, nameof(destination));

            ExtensibleObjectMapper.MapExtraPropertiesTo(
                typeof(TSource),
                typeof(TDestination),
                source.ExtraProperties,
                destination.ExtraProperties,
                definitionChecks,
                ignoredProperties
                );
        }