I have an Entity class which has a Dictionary of fields called Data.
Now I want to sort Entities by a field in Data. I was able to verify
the Linq expression for using fields in a dictionary as
e.Data["UserId"] as this seemed to work perfectly when I used LINQ to
Objects.
e.g. Entities.OrderBy(e => e.Data["UserId"])

However this same expression does not generate the correct NHibernate
criteria and errors out finally with a NullReferenceException for
propertyName at
NHibernate.Loader.Criteria.CriteriaQueryTranslator.GetEntityName(ICriteria
subcriteria, String propertyName) in CriteriaQueryTranslator.cs: line
541.

On debugging through NHibernate code, I figured that
NHibernate.Linq.Visitors.MemberNameVisitor.GetMemberName(ICriteria
rootCriteria, Expression expr) returns a null string in place of the
field name after visiting expr using its visitor. This seems to be the
cause of grief.
I am using an older version of NHibernate (not 2.x). Are there any
limitations in the NHibernate Linq visitor I should be aware of?

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to