Right, I suppose that what I'm doing wrong here is trying to have
several parameters (ie 'Milk', 'Bread') being assigned by only one
parameter (:current)...
So is there another way of having an in clause in a global/contextual
filter (apart of in my repository)?

On Jan 17, 6:51 pm, Nieve <[email protected]> wrote:
> Hello all,
> I've been trying to use contextual data filters using an in clause
> without much success. My code looks like that:
> var filterParametersType = new Dictionary<string, IType>(1);
>             filterParametersType.Add("current",
> NHibernateUtil.String);
>             cfg.AddFilterDefinition(new FilterDefinition
> ("nameContextFilter", "Name in (:current)", filterParametersType,
> true));
>
>             foreach (var mapping in cfg.ClassMappings)
>             {
>                 if (typeof(INameContextAware).IsAssignableFrom
> (mapping.MappedClass))
>                 {
>                     mapping.AddFilter("nameContextFilter", "Name in
> (:current)");
>                 }
>             }
>
> And my context is
> ProductNameContext.Current = "Milk', 'Bread";
> this produces the following SQL:
> SELECT this_.[Id] as Id1_1_0_, this_.[Name] as Name2_1_0_, this_.
> [Price] as Price3_1_0_ FROM [Product] this_ WHERE this_.Name in
> (@p0);@p0 = 'Milk', 'Bread'
>
> Anyone has an idea what I'm doing wrong?
-- 
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