One of the many reasons for using FluentNHibernate, the new QueryOver API, and the new Linq provider is all because they eliminate the “magic line” or lines representing properties or other things that might be presented at compile time.
Unfortunately, I am using spatial extensions for NHibernate that have not yet been updated to support QueryOver or LINQ. As a result, I am forced to use a combination of QueryOver Lambda expressions and strings to represent properties, etc., that I want to request.
I would like to do this - I want to ask Fluent NHibernate (or possibly the NHibernate QueryOver API) what the magic string should be. Here is an example of pseudo code:
I am currently writing -
var x = session.QueryOver<Shuttle>().Add(SpatialRestrictions.Intersects("abc", other_object));
What I would like to write is
var x = session.QueryOver<Shuttle>().Add(SpatialRestriction.Intersects(session.GetMagicString<Shuttle>(x => x.Abc), other_object));
Is there anything similar? Would it be hard to write?
EDIT: I just wanted to notice that this will be applied much more than just spatial. In fact, anything that has not been converted to QueryOver or LINQ can be useful.
source
share