Apartment Building Architecture and NHibernate

Can someone finally explain to me what is the best strategy for implementing transparent and smooth support for multi-user functions in a NHibernate powered domain model?

Im looking for a way to keep the domain logic as isolated from multiuser things as possible, such as TenantID filtering, etc.

+3
source share
6 answers

The easiest way is to use different databases for each client.

Implementing multi-user access in this way allows you to efficiently write one tenant application and only worry about multi-user work in the place where you create / retrieve the session.

( - ), , , , - ISessionFactory, , ( , - URL- ).

, - , .

Castle Windsor, NHibernate. () , factory . ISessionManager, factory ( -). , , ISession, factory, ISessionManager . factory factory, , , factory .

+2

, , .

+2

. IConnectionProvider "connection.provider".

DriverConnectionProvider ConnectionString, .

- :

    public class ContextualConnectionProvider : DriverConnectionProvider
    {

        protected override string ConnectionString
        {
            get
            {
                return GetCurrentTenantDatabaseConnectionStringInternally();
            }
        }

        public override void Configure(IDictionary<string, string> settings)
        {
            ConfigureDriver(settings);
        }

    }

, .

+1

, multi -tenancy , . , SaaSGrid , , Apprenda. SOA- ( NHibernate ), . , , ( ), SaaSGrid , - - , !

+1

Ayende . NHibernate - .

0

, , .

NHibernate , NHibernate 2.0 Aplpha 1.

. http://elegantcode.com/2008/05/15/implementing-nhibernate-interceptors/ http://www.codinginstinct.com/2008/04/nhibernate-20-events-and-listeners.html .

Also check out Ayende Rhino's security component as it works a lot to modify queries with additional restrictions based on security descriptors. You can view the source at https://rhino-tools.svn.sourceforge.net/svnroot/rhino-tools/trunk/security

0
source

Source: https://habr.com/ru/post/1697117/


All Articles