我正在开发 EntityFrameworkCore.Cosmo 提供程序并遇到 HasNoDiscriminator
方法。
保留下面的代码有什么用?
modelBuilder.Entity<Patient>().HasNoDiscriminator();
最佳答案
这是特定于 Cosmos 的模型定制。
To identify the entity type that a given item represent EF Core adds a discriminator value even if there are no derived entity types. The name and value of the discriminator can be changed.
If no other entity type will ever be stored in the same container the discriminator can be removed by calling HasNoDiscriminator.
来源:Cosmos-specific model customization
我怀疑目标是防止患者以外的其他实体存储在容器中。
关于c# - HasNoDiscriminator 在 EFCore 中的使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59712278/