コード例 #1
0
        /// <summary>
        /// Maps an object to another type.
        /// </summary>
        /// <typeparam name="TDestination">The type to map the object.</typeparam>
        /// <param name="source">The object to map.</param>
        /// <param name="targetObject">The referece to an existent target object.</param>
        /// <returns>The mapped object.</returns>
        public static TDestination Map <TDestination>(this IFWMap source, TDestination targetObject = null)
            where TDestination : class, new()
        {
            var mapper = FWIocManager.Default.Resolve <IFWMapper>();

            return(mapper.Map(source, targetObject));
        }
コード例 #2
0
        /// <summary>
        /// Maps an object to another type.
        /// </summary>
        /// <typeparam name="TDestination">The type to map the object.</typeparam>
        /// <param name="source">The object to map.</param>
        /// <param name="targetObject">The referece to an existent target object.</param>
        /// <returns>The mapped object.</returns>
        public static TDestination Map <TDestination>(this IFWMap source, TDestination targetObject = null)
            where TDestination : class, new()
        {
            var mapper = new FWValueInjecterMapper();

            return(mapper.Map(source, targetObject));
        }
コード例 #3
0
        /// <summary>
        /// Maps an object to another type.
        /// </summary>
        /// <typeparam name="TDestination">The type to map the object.</typeparam>
        /// <typeparam name="TInjection">The injection map type.</typeparam>
        /// <param name="source">The object to map.</param>
        /// <param name="targetObject">The referece to an existent target object.</param>
        /// <returns>The mapped object.</returns>
        public TDestination Map <TDestination, TInjection>(IFWMap source, TDestination targetObject = null)
            where TDestination : class, new()
            where TInjection : IFWInjection, new()
        {
            var mapper = Omu.ValueInjecter.Mapper.Instance;

            return(mapper.MapInject <TInjection>(typeof(TDestination), source) as TDestination);
        }
コード例 #4
0
 /// <summary>
 /// Maps an object to another type.
 /// </summary>
 /// <typeparam name="TDestination">The type to map the object.</typeparam>
 /// <typeparam name="TInjection">The injection map type.</typeparam>
 /// <param name="source">The object to map.</param>
 /// <param name="targetObject">The referece to an existent target object.</param>
 /// <returns>The mapped object.</returns>
 public TDestination Map <TDestination, TInjection>(IFWMap source, TDestination targetObject = null)
     where TDestination : class, new()
     where TInjection : IFWInjection, new()
 {
     if (targetObject == null)
     {
         targetObject = new TDestination();
     }
     targetObject.InjectFrom <TInjection>(source);
     return(targetObject);
 }
コード例 #5
0
 /// <summary>
 /// Maps an object to another type.
 /// </summary>
 /// <typeparam name="TDestination">The type to map the object.</typeparam>
 /// <param name="source">The object to map.</param>
 /// <param name="targetObject">The referece to an existent target object.</param>
 /// <returns>The mapped object.</returns>
 public TDestination Map <TDestination>(IFWMap source, TDestination targetObject = null)
     where TDestination : class, new()
 {
     return(Omu.ValueInjecter.Mapper.Map <TDestination>(source, targetObject));
 }
コード例 #6
0
 /// <summary>
 /// Maps an object to an entity.
 /// </summary>
 /// <typeparam name="TDestination">The entity type.</typeparam>
 /// <param name="source">The source object.</param>
 /// <returns>The mapped entity.</returns>
 public static TDestination MapEntity <TDestination>(this IFWMap source)
     where TDestination : class, IFWEntity, new()
 {
     return(source.Map <TDestination, FWEntityInjection>());
 }