How to Map to Protected Property using AutoMapper in C# and VB.NET

To map protected Properties using AutoMapper in C# and VB.NET you can use the following snippet.

Samples

Samples C#

Samples VB.NET

🙁 missing, feel free to provide a VB.NET sample

Another approach would be to create a method in the destination object to do the mapping.

Samples

Sample C#

Sample VB.NET

 

Compatibility: working .NET 2.0 working .NET 3.0 not tested .NET 3.5 not working .NET 4.0 not working .NET 4.5not working .NET 4.6

If you have any questions or suggestions feel free to rate this snippet, post a comment or Contact Us via Email.

Related links:

 

Please Share us:
Please rate this snippet

4 thoughts on “How to Map to Protected Property using AutoMapper in C# and VB.NET

Leave a Reply