private void EmitConvertItem(TypeBuilder typeBuilder, TypePair typePair, string methodName = ConvertItemMethod) { MapperCacheItem mapperCacheItem = CreateMapperCacheItem(typePair); MethodBuilder methodBuilder = typeBuilder.DefineMethod(methodName, OverrideProtected, typeof(object), new[] { typeof(object) }); IEmitterType sourceMemeber = EmitArgument.Load(typeof(object), 1); IEmitterType targetMember = EmitNull.Load(); IEmitterType callMapMethod = mapperCacheItem.EmitMapMethod(sourceMemeber, targetMember); EmitReturn.Return(callMapMethod).Emit(new CodeGenerator(methodBuilder.GetILGenerator())); }
private IEmitterType ConvertMember(MappingMember member, IEmitterType sourceMemeber, IEmitterType targetMember) { if (member.TypePair.IsDeepCloneable) { return(sourceMemeber); } MapperCacheItem mapperCacheItem = CreateMapperCacheItem(member.TypePair); IEmitterType result = mapperCacheItem.EmitMapMethod(sourceMemeber, targetMember); return(result); }
private IEmitterType ConvertMember(TypePair parentTypePair, MappingMember member, IEmitterType sourceMemeber, IEmitterType targetMember) { // if (member.TypePair.IsDeepCloneable && _config.GetBindingConfig(parentTypePair).HasNoValue) if (member.TypePair.IsDeepCloneable) { return(sourceMemeber); } MapperCacheItem mapperCacheItem = CreateMapperCacheItem(parentTypePair, member); IEmitterType result = mapperCacheItem.EmitMapMethod(sourceMemeber, targetMember); return(result); }