如何使用 NHibernate 处理动态表?
我会尽力解释我的情况;我的数据库中有大约 30 个表,其中 30 个表(例如 x)是部分动态的,当我说部分时,我的意思是可以向该表“x”添加更多列,但不能删除。一旦用户选择更多列,他应该能够从前端本身完成此操作,而无需开发人员参与。我已经在NHibernate中设计了我的DAL,现在的问题是如何实现动态DAL?
I will try to explain my situation; I have around 30 tables in my database out of these 30 one table (say x) is partially dynamic, when I say partially I mean that more columns can be added this table “x” but cannot be deleted. Once the user chooses to and more columns he should be able to do this from the frontend itself without getting the developer involved. I have designed my DAL in NHibernate, now the question is how do I achieve dynamic DAL?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用动态组件将这些属性映射到字典。
请记住,当您向映射添加列时,您必须重建 SessionFactory,但这不应该是一个大问题,因为它可能不会经常发生。
You can use Dynamic components to get those properties mapped to a dictionary.
Remember you'll have to rebuild your SessionFactory when you add a column to the mapping, but that shouldn't be a big issue, as it won't probably happen very often.