private void EmitMap(CompilationContext context) { if (_beforeMapBuilder != null) { context.LoadSource(LoadPurpose.Parameter); context.LoadTarget(LoadPurpose.Parameter); _beforeMapBuilder.Emit(context); } if (_customInvokerBuilder != null) { context.LoadSource(LoadPurpose.Parameter); context.LoadTarget(LoadPurpose.Parameter); _customInvokerBuilder.Emit(context); } else { foreach (var mapper in _memberMappers) { mapper.Emit(context); } } if (_afterMapBuilder != null) { context.LoadSource(LoadPurpose.Parameter); context.LoadTarget(LoadPurpose.Parameter); _afterMapBuilder.Emit(context); } }
public void Emit(CompilationContext context) { context.LoadSource(LoadPurpose.Parameter); context.CurrentType = typeof(TSource); _invokerBuilder.Emit(context); context.CurrentType = typeof(TTarget); }
internal override void EmitGetter(CompilationContext context) { var getMethod = _property.GetGetMethod(true); context.LoadSource(LoadPurpose.MemberAccess); context.EmitCall(getMethod); context.CurrentType = MemberType; }
public override void Emit(Type sourceType, Type targetType, CompilationContext context) { context.LoadSource(LoadPurpose.Parameter); context.CurrentType = sourceType; context.EmitCast(typeof(IEnumerable <>).MakeGenericType(_sourceElementType)); context.LoadTarget(LoadPurpose.Parameter); context.CurrentType = targetType; context.EmitCast(typeof(IEnumerable <>).MakeGenericType(_targetElementType)); _invokerBuilder.Emit(context); }
protected override void EmitSource(CompilationContext context) { context.LoadSource(LoadPurpose.Parameter); _invokerBuilder.Emit(context); context.CurrentType = SourceType; }
internal override void EmitGetter(CompilationContext context) { context.LoadSource(LoadPurpose.MemberAccess); context.Emit(OpCodes.Ldfld, _field); context.CurrentType = _field.FieldType; }