public class AutomappingConfiguration : DefaultAutomappingConfiguration
{
public override IEnumerable<IAutomappingStep> GetMappingSteps(AutoMapper mapper, IConventionFinder conventionFinder)
{
return new IAutomappingStep[]
{
new IdentityStep(this),
new VersionStep(this),
new ComponentStep(this, mapper),
new CustomPropertyStep(conventionFinder, this),
new HasManyToManyStep(this),
new ReferenceStep(this),
new HasManyStep(this)
};
}
} public class CustomPropertyStep : IAutomappingStep
{
private readonly IAutomappingStep _defaultPropertyStep;
public CustomPropertyStep(IConventionFinder conventionFinder, IAutomappingConfiguration cfg)
{
_defaultPropertyStep = new PropertyStep(conventionFinder, cfg);
}
public bool ShouldMap(Member member)
{
return _defaultPropertyStep.ShouldMap(member) || typeof(Enumeration).IsAssignableFrom(member.PropertyType);
}
public void Map(ClassMappingBase classMap, Member member)
{
_defaultPropertyStep.Map(classMap, member);
}
}