Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-84

Id generation should only choose 1 id property per class

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • None
    • 0.5
    • None
    • None

    Description

      Given the following class:

      public class Student
      {
      public ObjectId Id

      { get; set; }

      public ObjectId ParentId { get; set; }

      }

      Both of these will be considered an Id property and get automatically assigned. I personally believe that the driver needs to choose a convention by default and stick to it. For instance, id properties are always named Id unless overridden by an attribute, or a manual mapping. In addition, there needs to be a way to change the default convention to something like ID or

      {ClassName}

      Id.

      IIdSelectionConvention or something.

      Attachments

        Activity

          People

            robert@mongodb.com Robert Stam
            craig.wilson@mongodb.com Craig Wilson
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: