自动映射继承:如何为基类添加鉴别器约定
通过实现 ISubclassConvention,我可以更改类层次结构中子类的鉴别器值。我现在正在寻找一种方法来为我的基类设置鉴别器值。有没有办法通过约定覆盖来更改它,或者我是否必须为我的层次结构添加手动映射?
(IClassConvention 提供了 DiscriminatorValue 属性,但它是只读的,所以运气不佳。)
By implementing ISubclassConvention, I can change the Discriminator Value for the subclasses in my class hierarchy. I'm now looking for a way to set the Discriminator Value for my base classes as well. Is there a way to change it with a convention override or do I have to add a manual mapping for my hierarchy?
(The IClassConvention provides the DiscriminatorValue property but it is read-only, so no luck there.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我知道的唯一方法是为基类进行简单的映射覆盖。
现在“BaseDepot”将是 Depot 类的鉴别器值。
The only way I know is to make simple mapping override just for base class.
Now "BaseDepot" will be discriminator value for Depot class.