3
votes

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?

2

2 Answers

0
votes

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?

0
votes

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.