Provide an ObjectId generator for use with string types

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Done
    • Priority: Unknown
    • 8.2.3
    • Affects Version/s: None
    • None
    • None
    • Dotnet Drivers
    • None
    • None
    • None
    • None
    • None
    • None

      Some people like to use the string type for their Ids but store it as objectId in the database in order to keep MongoDb.Bson dependencies out of their POCO model.

      This works fine today using either HasConversion<ObjectId>, HasBsonRepresentation(BsonType.ObjectId) or [BsonRepresentation(BsonType.ObjectId)] except that there is no auto-generation.

      We unfortunately can not make this completely automated due to the order in which the conventions are applied in EF (it determines ValueGeneratedOnAdd before it knows about HasConversion or HasBsonRepresentation) but we can provide a string-capable ValueGenerator for ObjectIds to make it a little easier.

              Assignee:
              Damien Guard
              Reporter:
              Damien Guard
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: