NHibernate Filters

1 299 peržiūros
Praleisti ir pereiti prie pirmo neskaityto pranešimo

liam

neskaityta,
2009-04-20 20:41:532009-04-20
kam: Fluent NHibernate
Is there a way to configure NHibernate filters for use with auto
mapping? I want to implement multitenancy by having a field on every
table that identifies the tenant.

Paul Batum

neskaityta,
2009-04-22 08:24:102009-04-22
kam: fluent-n...@googlegroups.com
Hi Liam,

I haven't worked with filters so my knowledge is a little hazy, please correct me if I am on the wrong track here.

I presume you would implement the filters themselves using the fluent interface, so are you asking about how to automap an extra tenant column for each table in your application? In this case, do your entities have the tenant field defined on them, or are you doing something tricky with the persistence of the entities to see that the tenant value is set transparently without representing it directly on the entity?

Paul Batum

liam

neskaityta,
2009-04-25 02:01:332009-04-25
kam: Fluent NHibernate
I have not added the tenant descriminators yet but I expect that each
entity would have a tenant field since that is probably easiest. The
part I dont understand is how to setup the filter mapping using the
fluent interface.

http://74.125.95.132/search?q=cache:vR-X1s1ZBqcJ:www.hibernate.org/hib_docs/nhibernate/1.2/reference/en/html/filters.html+nhibernate+filters&cd=1&hl=en&ct=clnk&gl=au&client=firefox-a

Paul Batum

neskaityta,
2009-04-26 10:37:292009-04-26
kam: fluent-n...@googlegroups.com
Hmm. For some reason I thought there was a fluent interface for defining filters. Typically in this sort of scenario I use the google code search for the xml element name such as "filter-def". In this case its turned up no results so it seems that I was mistaken.

So what I suggest is that you define your filters using good old hbm-xml. There are a few ways to mix hbm xml and fluent mappings, some of which are covered here:
http://wiki.fluentnhibernate.org/show/FluentConfiguration

Let me know how it goes.

Paul Batum
Atsakyti visiems
Atsakyti autoriui
Persiųsti
0 naujų pranešimų