I have a solution with several projects. A business components project, an MVC web app, a DTO\'s and ViewModels project, a business component unit test project, and an MVC u
Just set the ShouldMapProperty
property of your configuration object in the initialize method.
Here is an example using the static API, however, you should be able to achieve the same in a similar fashion by using the non-static API.
Mapper.Initialize(i =>
{
i.ShouldMapProperty = p => p.GetMethod.IsPublic || p.GetMethod.IsAssembly;
i.CreateMap
If you use a profile, this must go in the constructor:
public class MyProfile : Profile
{
public MyProfile()
{
ShouldMapProperty = arg => arg.GetMethod.IsPublic || arg.GetMethod.IsAssembly;
// The mappings here.
}
}