title: How to configure Automapper to automatically ignore properties with ReadOnly attribute?
body: <h1>Context:</h1>
  
  <p>Let's say I have the following "destination" class:</p>
  
  <pre><code>public class Destination
  {
      public String WritableProperty { get; set; }
  
      public String ReadOnlyProperty { get; set; }
  }
  </code></pre>
  
  <p>and a "source" class with the <code>ReadOnly</code> attribute on one of it's properties:</p>
  
  <pre><code>public class Source
  {
      public String WritableProperty { get; set; }
  
      [ReadOnly(true)]
      public String ReadOnlyProperty { get; set; }
  }
  </code></pre>
  
  <p>It's obvious, but to be clear: I am going to map from <code>Source</code> class to <code>Destination</code> class in the following way:</p>
  
  <pre><code>Mapper.Map(source, destination);
  </code></pre>
  
  <h1>Problem:</h1>
  
  <p><strong>What are the ways to configure Automapper to automatically ignore property with <code>ReadOnly(true)</code> attribute?</strong></p>
  
  <h1>Constraints:</h1>
  
  <p>I use Automapper's <code>Profile</code> classes for configuration. I don't want to dirty up  classes with Automapper-specific attributes. I don't want to configure Automapper for every single read-only property and cause a lot of duplication by this way.</p>
  
  <h1>Possible (but not suited) solutions:</h1>
  
  <h2>1) Add attribute <code>IgnoreMap</code> to the property:</h2>
  
  <pre><code>    [ReadOnly(true)]
      [IgnoreMap]
      public String ReadOnlyProperty { get; set; }
  </code></pre>
  
  <p>I don't want to dirty up classes with automapper-specific attributes and make it dependent from it. Also I don't want to add additional attribute along with <code>ReadOnly</code> attribute.</p>
  
  <h2>2) Configure Automapper to ignore the property:</h2>
  
  <pre><code>CreateMap&lt;Source, Destination&gt;()
  .ForSourceMember(src =&gt; src.ReadOnlyProperty, opt =&gt; opt.Ignore())
  </code></pre>
  
  <p>It is not a way because it forces me to do that for every single property everywhere and also causes a lot of duplication.</p>