FluentNhibernate 动态运行时映射
我正在构建一个框架,人们可以在其中保存通过继承我的类创建的项目。我将迭代 appdomain 中的每种类型来查找我想要映射到 nhibernate 的类。我找到的每个类都将是继承类型的子类。
我知道如何在 FluentNhibernate 中创建子类型,但每个子类型都需要自己的 ClassMap 类。由于我直到运行时才知道这些,所以我无法做到这一点。
有没有一种方法可以将映射添加到流畅的 nhibernate?
注意,我知道在没有使用 Cfg 类的流畅 nhibernate 的情况下这是可能的,但我不想以两种不同的方式管理相同的代码。
I am building a framework where people will be able to save items that the created by inheriting a class of mine. I will be iterating over every type in the appdomain to find classes that I want to map to nhibernate. Every class that I find will be a subclass of the inherited type.
I know how to create sub types in FluentNhibernate, but every sub type requires its own ClassMap class. Since I won't know these untill runtime, there is no way I can do that.
Is there a way that I can add mappings to fluent nhibernate?
Note, I know this is possible without fluent nhibernate using the Cfg class, but I don't want to manage the same code two different ways.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
沿着线的东西
something along the lines
立刻就有了对此的支持,并且 api 仍然存在,但现在已被弃用。
There was support for this at once time, and the api is still there, but it is now depricated.