【发布时间】:2012-07-06 23:17:50
【问题描述】:
我已经在 Castle Facility 上运行了 Fluent NIBerate。
但是,如何设置 NamingStrategy?我尝试使用配置对象,但没有运气。我的命名策略是否需要在我的 Windsor 容器中注册?
【问题讨论】:
-
我宁愿先使用命名策略。
标签: nhibernate fluent-nhibernate castle-windsor
我已经在 Castle Facility 上运行了 Fluent NIBerate。
但是,如何设置 NamingStrategy?我尝试使用配置对象,但没有运气。我的命名策略是否需要在我的 Windsor 容器中注册?
【问题讨论】:
标签: nhibernate fluent-nhibernate castle-windsor
据我所知,没有办法在 NHibernate 工具中配置命名策略。请create a new issue这个。
作为一种解决方法,您可以从 DefaultConfigurationBuilder 继承并覆盖 GetConfiguration(),您将在其中应用 NamingStrategy。
要使用您刚刚创建的这个新的IConfigurationBuilder,请在创建时将其注入NHibernateFacility:
container.AddFacility(new NHibernateFacility(new MyNamingStrategyConfigurationBuilder()));
当然,最好的解决方案是在 DefaultConfigurationBuilder 中实现它并提交补丁 ;-)
【讨论】: