NHibernate Filters

1,296 vistas
Ir al primer mensaje no leído

liam

no leída,
20 abr 2009, 8:41:53 p.m.20/4/2009
para 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

no leída,
22 abr 2009, 8:24:10 a.m.22/4/2009
para 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

no leída,
25 abr 2009, 2:01:33 a.m.25/4/2009
para 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

no leída,
26 abr 2009, 10:37:29 a.m.26/4/2009
para 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
Responder a todos
Responder al autor
Reenviar
0 mensajes nuevos