From 40843c612a3644487f40aad3c2b7d1788a6c2527 Mon Sep 17 00:00:00 2001 From: danielmarbach Date: Thu, 2 Feb 2012 11:43:15 +0100 Subject: [PATCH] MappingEventBroker: AutoMapperAdapter fixed issue when source event args type is equal destination event args type. --- .../AutoMapperMapper.cs | 26 ++++--------------- .../Version.txt | 2 +- 2 files changed, 6 insertions(+), 22 deletions(-) diff --git a/source/bbv.Common.MappingEventBroker.AutoMapperAdapter/AutoMapperMapper.cs b/source/bbv.Common.MappingEventBroker.AutoMapperAdapter/AutoMapperMapper.cs index 16191a1..e00a9bd 100644 --- a/source/bbv.Common.MappingEventBroker.AutoMapperAdapter/AutoMapperMapper.cs +++ b/source/bbv.Common.MappingEventBroker.AutoMapperAdapter/AutoMapperMapper.cs @@ -27,32 +27,16 @@ namespace bbv.Common.MappingEventBroker.AutoMapperAdapter /// public class AutoMapperMapper : IMapper { - /// - /// Determines whether there exists a mapping from the provided - /// to the - /// . - /// - /// The source event argument type. - /// The destination event argument type. - /// - /// if there is a mapping; otherwise . - /// public bool HasMapping(Type sourceEventArgsType, Type destinationEventArgsType) { + if (sourceEventArgsType == destinationEventArgsType) + { + return true; + } + return Mapper.FindTypeMapFor(sourceEventArgsType, destinationEventArgsType) != null; } - /// - /// Maps the provided event argument from the - /// to the - /// . - /// - /// The source event argument type. - /// The destination event argument type. - /// The source event argument. - /// - /// The mapped event argument. - /// public EventArgs Map(Type sourceEventArgsType, Type destinationEventArgsType, EventArgs eventArgs) { return (EventArgs)Mapper.Map(eventArgs, sourceEventArgsType, destinationEventArgsType); diff --git a/source/bbv.Common.MappingEventBroker.AutoMapperAdapter/Version.txt b/source/bbv.Common.MappingEventBroker.AutoMapperAdapter/Version.txt index 2a11c14..8c22b89 100644 --- a/source/bbv.Common.MappingEventBroker.AutoMapperAdapter/Version.txt +++ b/source/bbv.Common.MappingEventBroker.AutoMapperAdapter/Version.txt @@ -1 +1 @@ -2 \ No newline at end of file +3 \ No newline at end of file