Hi there

and thanks for the links :) In the second link ayende is apparently
using a technique no longer supported from what I understand. I've
made some progress since my last post and I've managed to implement
the interceptor mentioned last in the article. I've also managed to
apply the filter to the Address class, now I'm trying to add the same
filter to the Adresses properties in the Student class. This is what I
got sofar

In the Contextinterceptor:

            if(Context.Current != null)
            {
                session.EnableFilter("customerfilter")
                    .SetParameter("customerid",
Context.Current.CustomerId)
                    .SetParameter("regionalid",
Context.Current.ReginalId);
            }

I'm also doing this

            var filterParametersType = new Dictionary<string, IType>
(1);
            filterParametersType.Add("customerid",
NHibernateUtil.Int32);
            filterParametersType.Add("regionalid",
NHibernateUtil.Int32);
            nhCfg.AddFilterDefinition(new FilterDefinition
("customerfilter", ":customerid= customeridand :regionalid =
regionalid", filterParametersType, false));

            foreach (var mapping in nhCfg.ClassMappings)
            {
                if (typeof(IContextAware).IsAssignableFrom
(mapping.MappedClass))
                {
                    mapping.AddFilter("customerfilter", ":customerid=
customeridor :regionalid = regionalid");
                }
            }

That seem to be working, however calling Student.Addresses doesn't use
the filter so from what I understand I need also to filter that
specific relationship. Preferably I'd rather have a property in the
Student class to be mapped to a filtered Address, so I can easily call
Student.Adress. I have no idea how to do that though, don't think you
can add a filter on a one-to-one relationship, so is that even
possible?
-- 
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