I would like to hear some feedback on a scenario that I am trying to implement. I have currently implemented this scenario using Criteria API for NHibernate and was wondering if there was anything similar that was implemented for Entity Framework 4.1.
I have a need where the end user can select filtering criteria from the UI and thus build a query that can contain complex AND/OR criteria.
For e.g.: The user can say: I want Students with (Zip Code = 92037 AND Gender = F) OR (ZipCode = 92101 and Gender = M)
OR
I want students with (State = CA OR State = FL) AND GPA = 4.0 AND GENDER = M
These queries are usually built using a tree control on the front end.
I currently have this working using NHibernate. The Criteria API in NHibernate is really awesome for doing this. However, NHibernate has a major bug, and that is it doesn't allow multiple joins on a 1:many table.
So for e.g. if I had a table containing a CATCODE (Category code) and an Answer, NHibernate will not currently let me do multiple querying using Criteria API.
So I cannot for e.g. do: WHERE CATCODE = A and Answer in (A,B,C) AND CATCODE = B and Answer in (V,H,Y)
.
Due to this limitation, I have been trying to move out of NHibernate into Entity Framework. I didn't know if there was a nice way to do this kind of stuff using APIs.
Can anyone tell me a better solution to achieve such functionality, if there is one?
Would love to hear from both NHibernate and EF experts if there are ways to solve this.