Beispiel #1
0
            public object Map(ResolutionContext context, IMappingEngineRunner mapper)
            {
                var newSource           = context.TypeMap.Substitution(context.SourceValue);
                var substitutionContext = context.CreateValueContext(newSource, newSource.GetType());

                return(mapper.Map(substitutionContext));
            }
Beispiel #2
0
		public object Map(ResolutionContext context, IMappingEngineRunner mapper)
		{
			if (context.SourceValue == null)
			{
				return mapper.FormatValue(context.CreateValueContext(null));
			}
			return mapper.FormatValue(context);
		}
Beispiel #3
0
 public object Map(ResolutionContext context, IMappingEngineRunner mapper)
 {
     if (context.SourceValue == null)
     {
         return(mapper.FormatValue(context.CreateValueContext(null)));
     }
     return(mapper.FormatValue(context));
 }
        public void When_creating_a_new_context_from_an_existing_context_Should_preserve_context_type_map()
        {
            var map = new TypeMap(new TypeInfo(typeof(int)), new TypeInfo(typeof(string)), MemberList.Destination);

            var context = new ResolutionContext(map, 5, typeof(int), typeof(string), new MappingOperationOptions());

            ResolutionContext newContext = context.CreateValueContext(10);

            newContext.GetContextTypeMap().ShouldNotBeNull();
        }
        public void When_creating_a_new_context_from_an_existing_context_Should_preserve_context_type_map()
        {
            var map = new TypeMap(new TypeInfo(typeof(int)), new TypeInfo(typeof(string)));

            var context = new ResolutionContext(map, 5, typeof(int), typeof(string), new MappingOperationOptions());

            ResolutionContext newContext = context.CreateValueContext(10);

            newContext.GetContextTypeMap().ShouldNotBeNull();
        }
        public void When_creating_a_new_context_from_an_existing_context_Should_preserve_context_type_map()
        {
            var map = new TypeMap(new TypeInfo(typeof(int), BindingFlags.Instance | BindingFlags.Public), new TypeInfo(typeof(string), BindingFlags.Instance | BindingFlags.Public), MemberList.Destination);

            var context = new ResolutionContext(map, 5, typeof(int), typeof(string), new MappingOperationOptions(), Mapper.Engine);

            ResolutionContext newContext = context.CreateValueContext(10);

            newContext.GetContextTypeMap().ShouldNotBeNull();
        }
Beispiel #7
0
        public object Map(ResolutionContext context, IMappingEngineRunner mapper)
        {
            if (context == null) throw new ArgumentNullException("context");
            if (mapper == null) throw new ArgumentNullException("mapper");

            if (context.SourceValue == null)
            {
                return mapper.FormatValue(context.CreateValueContext(null));
            }
            return mapper.FormatValue(context);
        }
 public object Map(ResolutionContext context, IMappingEngineRunner mapper)
 {
     var newSource = context.TypeMap.Substitution(context.SourceValue);
     var substitutionContext = context.CreateValueContext(newSource, newSource.GetType());
     return mapper.Map(substitutionContext);
 }