title: Framework for merging business entities
body: <p>Is there any framework which can do the following:</p>
  
  <pre><code>var source = new Entity()
  {
      StringProp = null,
      IntProp = 100,
  
  };
  
  var target = new Entity()
  {
      StringProp = "stringValue", // Property value should remain the same if source value is null 
      IntProp = 222
  };
  
  var mergedEntity = MergeFramework.Merge(source, target); // Here is what I am looking for
  
  Assert.AreEqual(100, mergedEntity.IntField);
  Assert.AreEqual("stringValue", mergedEntity.StringField);
  </code></pre>
  
  <p>Below is the workflow where I need it:</p>
  
  <ol>
  <li><p>App gets entity instance. Some properties of the instance are null.
  (source instance)</p></li>
  <li><p>App fetches from database the entity with the same identity as in the source. (target instance)</p></li>
  <li><p>Merges two entities and saves merged to database.</p></li>
  </ol>
  
  <p>The main issue is that there are nearly 600 entities in my project, so I don't want to write merging logic for each entity manually. Basically, I am looking for something flexible like AutoMapper or ValueInjecter which satisfy the following requirements:</p>
  
  <ul>
  <li><p>Provide possibility to specify type merge conditions. For example: if source.IntProp == int.MinInt -> do not merge the property</p></li>
  <li><p>Provide possibility to specify property specific conditions. Like in AutoMapper:</p>
  
  <p>Mapper.CreateMap().ForMember(dest => dest.EventDate, opt => opt.MapFrom(src => src.EventDate.Date));</p></li>
  </ul>