Skip to content

Commit

Permalink
MappingEventBroker: AutoMapperAdapter fixed issue when source event a…
Browse files Browse the repository at this point in the history
…rgs type is equal destination event args type.
  • Loading branch information
danielmarbach committed Feb 2, 2012
1 parent a89bf86 commit 40843c6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 22 deletions.
Expand Up @@ -27,32 +27,16 @@ namespace bbv.Common.MappingEventBroker.AutoMapperAdapter
/// </summary>
public class AutoMapperMapper : IMapper
{
/// <summary>
/// Determines whether there exists a mapping from the provided
/// <paramref name="sourceEventArgsType"/> to the
/// <paramref name="destinationEventArgsType"/>.
/// </summary>
/// <param name="sourceEventArgsType">The source event argument type.</param>
/// <param name="destinationEventArgsType">The destination event argument type.</param>
/// <returns>
/// <see langword="true"/> if there is a mapping; otherwise <see langword="false"/>.
/// </returns>
public bool HasMapping(Type sourceEventArgsType, Type destinationEventArgsType)
{
if (sourceEventArgsType == destinationEventArgsType)
{
return true;
}

return Mapper.FindTypeMapFor(sourceEventArgsType, destinationEventArgsType) != null;
}

/// <summary>
/// Maps the provided event argument from the
/// <paramref name="sourceEventArgsType"/> to the
/// <paramref name="destinationEventArgsType"/>.
/// </summary>
/// <param name="sourceEventArgsType">The source event argument type.</param>
/// <param name="destinationEventArgsType">The destination event argument type.</param>
/// <param name="eventArgs">The source event argument.</param>
/// <returns>
/// The mapped event argument.
/// </returns>
public EventArgs Map(Type sourceEventArgsType, Type destinationEventArgsType, EventArgs eventArgs)
{
return (EventArgs)Mapper.Map(eventArgs, sourceEventArgsType, destinationEventArgsType);
Expand Down
@@ -1 +1 @@
2
3

0 comments on commit 40843c6

Please sign in to comment.