public object MapObject(object srcValue, object dstValue) { if (dstValue == null) { return null; } var reader = this._readerFactory.CreateReader(srcValue) ?? new DefaultObjectReader(srcValue); var convertArgs = new ConvertArgs(reader, this, dstValue.GetType()) { ConvertedObject = dstValue }; ConvertCore(convertArgs); return dstValue; }
private void ConvertCore(ConvertArgs convertArgs) { foreach (var currentObjectConverter in _currentObjectConverters) { if (currentObjectConverter.Value.TryConvert(convertArgs)) { return; } } foreach (var objectConverter in _defaultObjectConverters) { if (objectConverter.Value.TryConvert(convertArgs)) { return; } } }
public object MapObject(object srcValue, Type dstType) { var reader = this._readerFactory.CreateReader(srcValue) ?? new DefaultObjectReader(srcValue); var convertArgs = new ConvertArgs(reader, this, dstType); ConvertCore(convertArgs); return convertArgs.ConvertedObject; }