CamelCaseElementNameConvention clash with type discriminator "_t"

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Unknown
    • 8.4.0, 9.1.0, 10.0.0
    • Affects Version/s: 8.3.3, 9.0.4
    • None
    • None
    • Dotnet Drivers
    • Not Needed
    • None
    • None
    • None
    • None
    • None
    • None

      Hi there,

      I maintain an open-source project using EF Core to support both PostgreSQL and MongoDB databases.

      I am using TPH tables/collections with a type discriminator (element "_t" in the case of MongoDB), specifying them like this for the case of MongoDB: https://github.com/finlabsuk/open-banking-connector/blob/web-app/17.1.0/src/OpenBanking.Library.Connector/Persistence/BaseDbContext.cs#L264-L272

      Everything has so far worked fine provided I do queries on the base class with manual filtering like this: https://github.com/finlabsuk/open-banking-connector/blob/web-app/17.1.0/src/OpenBanking.Library.Connector/Operations/VariableRecurringPayments/DomesticVrpConsentAuthContextOperations.cs#L177-L179

      I thought I would add support for CamelCaseElementNameConvention with the MongoDB EF Core provider. And, while this convention respected "_id" elements, it started using discriminator element "T" rather than "_t" despite the explicit setting referenced above.

      I realise you don't officially support TPH/discriminators, but could you possibly fix CamelCaseElementNameConvention in your EF Core Provider so that it respects the following setting: modelBuilder.Entity<MyEntity>().HasDiscriminator<string>("_t")?

      I am also open to the possibility I am doing things wrong so please feel free to tell me a better way to do things.

      BR,

      Mark

            Assignee:
            Arthur Vickers
            Reporter:
            Mark Murphy
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: