Monday, October 17, 2016

protected override

Consider:

using AutoMapper;
namespace Payme.Whatever
{
   public class FooMapping : Profile
   {
      public override string ProfileName => GetType.Name;
      
      protected override void Configure()
      {
         Mapper.CreateMap<Foo, Bar>();
      }
   }
}

 
 

Random thoughts on this...

  1. I'm not sure what setting the Profile name in AutoMapper's way of doing things gets us.
  2. protected override is a thing. Think IDisposable.
    • This may or may not be a Liskov violation. It depends on the intent of "contract" and would be changes.
      • If you do your own thing in an IDisposable pattern and then call base.Dispose() it's not a violation.

No comments:

Post a Comment