I was trying to imitate what Ayende discusses in this blog post: http://ayende.com/Blog/archive/2006/12/26/LocalizingNHibernateContextualParameters.aspx
Did this work in pre 2.1 versions? I'm not sure what your're getting at with your question. Am I doing something incorrectly? I'll admit I am still new to NHibernate and am learning as I develop. On Dec 11, 7:07 am, Fabio Maulo <[email protected]> wrote: > The filter is to filter entities and not to be used in a formula. > btw... did you see the result of a simple query over the class Category ? > > 2009/12/9 Mike <[email protected]> > > > > > > > I am using NHibernate 2.1. I am trying to use a filter in a property > > formula, but am getting the following error: > > > filter-def for filter named 'SiteFilter' was never used to filter > > classes nor collections. > > > Here is my mapping file: > > > <?xml version="1.0" encoding="utf-8" ?> > > <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" > > assembly="DataAccess" namespace="DataAccess.Catalog"> > > <class name="Model.Catalog.Category,Model" table="Catalog.Category"> > > > <id name="ID" column="ID" type="Int32" unsaved-value="0"> > > <generator class="native" /> > > </id> > > > <property name="Name" column="Name" type="string" length="50" not- > > null="true" /> > > > <property name="ProductCount" formula="(SELECT COUNT(*) from > > Catalog.Product WHERE Product.CategoryID = ID)" lazy="true" /> > > <property name="SiteProductCount" formula="(SELECT COUNT(*) from > > Catalog.Product WHERE Product.CategoryID = :SiteFilter.SiteID)" > > lazy="true" /> > > > <many-to-one name="Image" > > column="ImageID" > > not-null="true" > > class="Model.Catalog.Image,Model" > > cascade="save-update" /> > > > <bag name="Products" table="Catalog.Product" generic="true" > > inverse="true"> > > <key column="CategoryID" /> > > <one-to-many class="Model.Catalog.Product,Model"/> > > </bag> > > > </class> > > > <filter-def name="SiteFilter"> > > <filter-param name="SiteID" type="Int32" /> > > </filter-def> > > </hibernate-mapping> > > What am I doing wrong? Thanks for any help! > > > -- > > > 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]<nhusers%[email protected] > > > > > . > > For more options, visit this group at > >http://groups.google.com/group/nhusers?hl=en. > > -- > Fabio Maulo -- 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.
