通过 NHibernate 成功使用 WCF 数据服务 (OData)?
我正在开发一个 CQRS 风格的系统,该系统使用 NSericeBus 处理命令,并通过只读 OData 提要提供查询。
我们希望 NHibernate 支持 WCF 数据服务 feed,这样我们就可以控制数据在 feed 中的显示方式(计算字段等),而实体框架提供程序不允许这样做。
但是,在 Linq to NHibernate 中使用反射提供程序时,我们在导航到相关实体时会遇到错误(例如 http://server/feed/Foo(1)/Bar)。
有人做过 Linq to NHibernate 支持的 WCF 数据服务吗?
I'm working on a CQRS-style system with commands processed with NSericeBus and queries provided through a read-only OData feed.
We would like to have the WCF Data Services feed backed by NHibernate so we can have control over how our data appears in the feed (calculated fields, etc), which the Entity Framework provider does not allow.
However, using the reflection provider with Linq to NHibernate, we are getting errors when we navigate to related entities (e.g, http://server/feed/Foo(1)/Bar).
Has anyone made a Linq to NHibernate backed WCF Data Service work?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您想要做实体框架不允许的事情是什么意思?
如果您需要计算字段,您可以使用计算字段在数据库(SQL Server?)中定义一个视图,并将该视图合并到您的只读实体模型中。
如果您需要预先计算字段,您可以简单地在反规范化器代码中执行此操作。
你需要哪些场景是 EF 无法做到的?
How do you mean, you want to do something that the Entity Framework does not allow?
If you need calculated fields, you can define a View in your DB (SQL Server?) with calculated fields, and incorporate that View into your read-only Entity Model.
If you need to pre-calculate the fields, you can simply do that in your denormalizer code.
What scenario do you need that you cannot do with EF?
最像您要寻找的是 NHibernate.OData。这允许您获取传入的 odata 并让 NHibernate 自动将其转换为 DetachedCriteria 实例。
Most like what you're looking for is NHibernate.OData. This allows you to take the passed in odata and have NHibernate auto-convert it to a DetachedCriteria instance.