If you want an example you can use this
http://code.google.com/p/unhaddins/source/browse/trunk/uNhAddIns/uNhAddIns/Cache/RegionQueryCacheFactory.cs

<http://code.google.com/p/unhaddins/source/browse/trunk/uNhAddIns/uNhAddIns/Cache/RegionQueryCacheFactory.cs>That
is part of the TolerantQueryCache but the configuration can be used to
specify the IQueryCache per region and/or modify the name of the region.
As you can see is a matter of few lines (at least for query-cache).

2009/10/27 Fabio Maulo <[email protected]>

> It is easy using a cache.query_cache_factory adding a tenant-prefix to
> each region.
>
> 2009/10/26 Tuna Toksoz <[email protected]>
>
> You can also depend your cache providers on the user specific stuff.
>> That some class should already be available in yourt code to put the
>> username into session or something, i don't think this is a problem, is it?
>>
>>
>> Tuna Toksöz
>> Eternal sunshine of the open source mind.
>>
>> http://devlicio.us/blogs/tuna_toksoz
>> http://tunatoksoz.com
>> http://twitter.com/tehlike
>>
>>
>>
>>
>> On Tue, Oct 27, 2009 at 12:15 AM, Niclas Pehrsson <[email protected]>wrote:
>>
>>>
>>> It could be if DynamicConnectionProvider would use the WebSession
>>> variable to point out the databasename.
>>> Then DynamicConnectionProvider could use the WebSession to build the
>>> session with the right databaseconnectionstring.
>>> It will be kind of akward way to do it. Some class needs to be
>>> responsible to put the right databasename in a websession with the
>>> right key so the DynamicConnectionProvider can read it this isn't
>>> obvious, but maybe the only way to do it.
>>>
>>> Im thinking about using OpenSession(IDbConnection dbConnection), more
>>> visible.
>>>
>>> But I have something in my back head telling me that hasn't
>>> SessionFactory something to do with second level cache or something
>>> else that would make this a bad solution?
>>>
>>> On Oct 26, 10:53 pm, Tuna Toksoz <[email protected]> wrote:
>>> > Does that solve your problem?
>>> >
>>> > Tuna Toksöz
>>> > Eternal sunshine of the open source mind.
>>> >
>>> >
>>> http://devlicio.us/blogs/tuna_toksozhttp://tunatoksoz.comhttp://twitter.com/tehlike
>>> >
>>> > On Mon, Oct 26, 2009 at 11:51 PM, Tuna Toksoz <[email protected]>
>>> wrote:
>>> > > oh yeah
>>> >
>>> > >
>>> http://nhforge.org/wikis/howtonh/dynamically-change-user-info-in-conn...
>>> >
>>> > > Tuna Toksöz
>>> > > Eternal sunshine of the open source mind.
>>> >
>>> > >http://devlicio.us/blogs/tuna_toksoz
>>> > >http://tunatoksoz.com
>>> > >http://twitter.com/tehlike
>>> >
>>> > > On Mon, Oct 26, 2009 at 11:49 PM, Tuna Toksoz <[email protected]>
>>> wrote:
>>> >
>>> > >> I think He does but i couldn't remember the keywords.
>>> >
>>> > >> Tuna Toksöz
>>> > >> Eternal sunshine of the open source mind.
>>> >
>>> > >>http://devlicio.us/blogs/tuna_toksoz
>>> > >>http://tunatoksoz.com
>>> > >>http://twitter.com/tehlike
>>> >
>>> > >> On Mon, Oct 26, 2009 at 11:49 PM, Niclas Pehrsson <
>>> [email protected]>wrote:
>>> >
>>> > >>> It would be really nice if someone has a link to Fabio's solution,
>>> or
>>> > >>> maybe he has it on his blog?
>>> >
>>> > >>> On Oct 26, 10:40 pm, Tuna Toksoz <[email protected]> wrote:
>>> > >>> > Fabio has a better solution. I think it was
>>> implementing/extending
>>> >
>>> > >>> > NHibernate.Connection.DriverConnectionProvider
>>> >
>>> > >>> > thing.
>>> >
>>> > >>> > Tuna Toksöz
>>> > >>> > Eternal sunshine of the open source mind.
>>> >
>>> > >>>
>>> http://devlicio.us/blogs/tuna_toksozhttp://tunatoksoz.comhttp://twitt...
>>> >
>>> > >>> > On Mon, Oct 26, 2009 at 11:32 PM, Jason Dentler <
>>> > >>> [email protected]>wrote:
>>> >
>>> > >>> > > Niclas,
>>> >
>>> > >>> > > ISessionFactory.OpenSession accepts an IDbConnection. Using
>>> your
>>> > >>> favorite
>>> > >>> > > IoC framework, create a unit-of-work scoped connection to the
>>> > >>> specific
>>> > >>> > > customer's DB and pass it in to a single application-scoped
>>> session
>>> > >>> > > factory.  I doubt this was the intended purpose, but it may
>>> work
>>> > >>> anyway. I
>>> > >>> > > would start there.
>>> >
>>> > >>> > > Thanks,
>>> > >>> > > Jason
>>> >
>>> > >>> > > On Mon, Oct 26, 2009 at 4:12 PM, Niclas Pehrsson <
>>> [email protected]
>>> > >>> >wrote:
>>> >
>>> > >>> > >> Hi I'm doing some research when using NHibernate with Multi
>>> tenancy,
>>> > >>> I
>>> > >>> > >> have choosen to start with multi databases to solve the
>>> tenancy
>>> > >>> > >> problem. One database per customer. We hope that our product
>>> will
>>> > >>> have
>>> > >>> > >> several thousands customers, this will mean several databases.
>>> >
>>> > >>> > >> Now say that we will host this product and let the login of
>>> the
>>> > >>> > >> customer decide which database to use for the user, then we
>>> need to
>>> > >>> > >> have thousands of SessionFactories in the server memory cause
>>> we
>>> > >>> don't
>>> > >>> > >> wanna build it each time a user requests for it.
>>> > >>> > >> This will take a lot of memory, and some performance for the
>>> > >>> > >> sessionfactory lookup, that has been a common solution to
>>> solve this
>>> > >>> > >> problem by the research I have seen so far.
>>> >
>>> > >>> > >> So is thousands of loaded sessionfactories a problem? or will
>>> it be
>>> > >>> > >> fine?
>>> >
>>> > >>> > >> Can a custom like implementation of a garbage collection be
>>> used
>>> > >>> that
>>> > >>> > >> throws out sessionfactories that hasn't been used for a time
>>> solve
>>> > >>> > >> this problem?
>>>
>>>
>>
>> >>
>>
>
>
> --
> Fabio Maulo
>



-- 
Fabio Maulo

--~--~---------~--~----~------------~-------~--~----~
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