I have a Store object with a property of type Location. There is a many-to-one mapping between Store and Location based on zipcode. The following code:
Code:
criteria.Add(Expression.And(Expression.Between("Location.Latitude", radiusAssistant.MinLatitude, radiusAssistant.MaxLatitude),
Expression.Between("Location.Longitude", radiusAssistant.MinLongitude, radiusAssistant.MaxLongitude)));
return criteria.List();
Throws the error:
could not resolve property:Location.Latitude
However, a search on zip code works just fine like so:
Code:
criteria.Add(Expression.Eq("Location.ZipCode" zipcode);
My mapping files:
Store mapping:
Code:
<many-to-one name="Location" column="zipcode" class="Store.Location, Store" />
Location mapping:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class
name="Store.Location, Store"
table="ZipCode" >
<id name="ZipCode" column="zipcode" type="String" unsaved-value="" access="nosetter.camelcase-underscore">
<generator class="assigned" />
</id>
<property name="AreaCode" column="areacode" type="String"/>
<property name="Latitude" column="latitude" type="Double"/>
<property name="Longitude" column="longitude" type="Double"/>
</class>
</hibernate-mapping>