Filters and caching

24 views
Skip to first unread message

smalldave

unread,
Mar 22, 2012, 1:11:28 PM3/22/12
to nhu...@googlegroups.com
I'm trying to find a way to localize entity properties in NHibernate that fits an existing schema.
I've been through the forums / stackoverflow etc so not trying to start a debate on localization

I've got very close to something I'm happy with. I end up with a fluent mapping that looks like

HasMany(p => p.LocalisedValues).KeyColumn("AKeyColumn").ApplyFilter<LocaleFilter>("LocaleId = :localeId").Cache.Region("Test").ReadOnly();

where LocalisedValues is a collection of object that has a property for each property of the entity I want to localize.

I can set the filter immediately after creation of the session and it all works very nicely until I look at the caching.
Looking through the debug logs I get "Refusing to add to cache due to enabled filters" and looking at the source I can see why that is.

My questions are
1. Are filters the only way I can reduce the LocalisedValues collection to just the values for the current locale?

2. I see that the message about caching comes directly from hibernate. If I wanted to have a go at implementing caching for filters what process should I follow?
Is nHibernate just a straight port of hibernate or do its features diverge?



smalldave

unread,
Mar 23, 2012, 7:44:10 AM3/23/12
to nhu...@googlegroups.com
Read the contributor guide and found this issue

https://nhibernate.jira.com/browse/NH-3090
Reply all
Reply to author
Forward
0 new messages