title: MongoDb id generator is not working
body: <p>I have a simple need <code>generate string ID if field is null before inserting</code>. It works fine if property has name <code>Id</code>, but otherwise it doesn't.</p>
  
  <p>I have following class:</p>
  
  <pre><code>public abstract class CampaignBase
  {
     [BsonId(IdGenerator = typeof(StringObjectIdGenerator))]
     [BsonRepresentation(BsonType.ObjectId)]
     public string CampaignId { get; set; }
  }
  
  public class Campaign : CampaignBase {}
  </code></pre>
  
  <p>Now when I insert <code>MyData</code> in the database I get <code>null</code> instead of generated id. It seems that these attributes just are not applied, because if property has <code>Id</code> name then if works fine and attribute can change actual data layout (<code>string</code>/<code>objectid</code>/etc).</p>
  
  <p>This is how I save it:</p>
  
  <p><a href="https://i.stack.imgur.com/x7Xde.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/x7Xde.png" alt="enter image description here"></a></p>
  
  <p><code>campaign</code> and <code>campaignBase</code> are referencing to the same object, so don't mind it.</p>
  
  <p>Where UpdateOptions:</p>
  
  <pre><code>protected static UpdateOptions UpdateOptions =&gt; new UpdateOptions
  {
      IsUpsert = true
  };
  </code></pre>
  
  <p>And here it is: null is arriving:</p>
  
  <p><a href="https://i.stack.imgur.com/5Yg6o.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5Yg6o.png" alt="enter image description here"></a></p>
  
  <p>Am I missing something?</p>