将Castle ActiveRecord/NHibernate与WCF一起使用时是否有陷阱? [英] Are there any gotchas when using Castle ActiveRecord/NHibernate with WCF?

查看:108
本文介绍了将Castle ActiveRecord/NHibernate与WCF一起使用时是否有陷阱?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Activerecord给数据库设计带来的灵活性,我们正在为DAL寻找它,并围绕它构建模型.我们将在所有这些之上创建WCF服务.使用基于NHibernate的Castle Activerecord时,有任何陷阱或兼容性问题吗?特别是涉及WCF使用的DataContractSerializer.由于ActiveRecord不会使用IQueryable,因此错过太多了吗?

The kind of flexibility that Activerecord gives to our DB design, we are looking at it for our DAL and build model around it. We will be creating a WCF service on top of all this. Are there any gotchas or compat issues when using NHibernate based Castle Activerecord? Specially when it comes to the DataContractSerializer that WCF uses. Since ActiveRecord will not be using IQueryable, is it too much to miss??

推荐答案

序列化的对象=分离的对象.一旦您通过WCF通过电线发送了一个对象,就可以了.

Serialized object = detached object. And once you send an object over the wire via WCF, that's what you've got.

所以最大的问题是,将NHibernate与WCF一起使用时,您将要处理的是分离的对象,这迫使您编写代码的方式有所不同.您将失去NHibernate的缓存功能和延迟加载功能.您必须预先装载聚合材料,然后才能通过电线将其运送出去.

So the big issue is that you're going to be dealing with when using NHibernate with WCF is detached objects, which forces you to write your code a bit differently. You lose NHibernate's caching abilities and lazy loading features. You've got to pre-load your aggregates before you ship them off over the wire.

如果您改为使用数据传输对象,那当然就没有什么意义了,但是既然您提到了ActiveRecord,我想那不是计划.

Of course that's all moot if you utilize data transfer objects instead, but since you mentioned ActiveRecord I am guessing that wasn't the plan.

我在这里可能不合时宜.希望ActiveRecord专家可以提供更多详细信息.

I may be way off base here. Hopefully an ActiveRecord guru can give more details.

这篇关于将Castle ActiveRecord/NHibernate与WCF一起使用时是否有陷阱?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆