开发者

How to convert Castle Activerecord to pure NHibernate or Fluent NHibernate?

I'm going to refactor a growing project from using Castle Activerecord to pure NHibernate or Fluent NHibernate with Service/Repository pattern and POCO.

What would be an easiest way to obtain hbm xml from existing Castle Activerecord model?

Another question, is it 开发者_StackOverflowpossible to convert hbm to Fluent NH and vice versa?


Remi already pointed out how to generate hbm from ActiveRecord. It's also possible to generate hbm mappings from Fluent NHibernate by using ExportTo(). It's not possible to convert hbm to FNH (that is, C#) code, but you can load them from FNH.

Using Castle ActiveRecord does not imply that you can't use repositories. In fact, Castle ActiveRecord does not force you to use the ActiveRecord pattern, and it doesn't even require you do inherit ActiveRecordBase in your persistent classes. You can use ActiveRecordMediator as a repository, or wrap it in a repository interface/implementation as Rhino.Commons does.


http://stw.castleproject.org/Active%20Record.Configuration%20Reference.ashx

You can also output nhibernate mapping files to the AppDomain.BaseDirectory.

<activerecord isDebug="true"><config></config></activerecord>

I think that should give you the mapping file in your application directory


There is at least one open source project to convert HMB to FNH:

http://code.google.com/p/nhibernate-hbm-to-fluent-converter/

As others have already said, you can easily convert ActiveRecord to HBM and FluentNHibernate to HBM.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜