Thanks for sharing this Chris, i think this would make a good addition to contrib, what do you guys think?
On 13 Jan 2011 00:04, Chris Richards <chris.richa...@yellowfeather.co.uk> wrote:
I think the best way to solve this is to reinstate the
IMultiTenantRepository marker interface, add this to the appropriate
repositories and update MultiTenantSessionFactoryKeyProvider so that
it checks for the implementation of this interface. If it is
implemented then attempt to get the factory key from the tenant
context otherwise just return NHibernateSession.DefaultFactoryKey.
I'll test this tomorrow and update my sample project.
On Jan 12, 11:29 pm, Chris Richards
> That is something I hadn't considered, if you're trying to access the
> master database whilst responding to a request on a subdomain it will
> provide the session factory key for the tenant. Will have a think how
> best to solve it and post an update.
> As a workaround, you can override the Session get method to use
> On Jan 12, 10:57 pm, Paul <p...@ukcreativedesigns.com> wrote:
> > Thank you so much, I attempted this myself last night but went the
> > wrong way about it. These seems much more elegant!
> > 1 question though, I have created a custom repository called
> > ITenantRepository with a function to return all tenants and eager load
> > some config settings for each config.
> > But the tenantRepository is trying to use a session factory for one of
> > my tenants instead of the default...how can i override the factory key
> > for this repository...I may be overlooking something simple here.
> > Thank you for your efforts!
> > Paul
> > On Jan 12, 12:48 pm, Chris Richards
> > <chris.richa...
> > > Hi Paul,
> > > I've forked S#arp Architecture and made some minor changes to allow
> > > different methods of getting the session factory key.
> > > Basically I've created an interface ISessionFactoryKeyProvider to hide
> > > the details of getting the session factory key. The default
> > > implementation I've added, DefaultSessionFactoryKeyProvider, uses the
> > > existing SessionFactoryAttribute so the only change required to
> > > existing application is to register DefaultSessionFactoryKeyProvider
> > > in the container. To use a different method it is just a case of
> > > providing and registering your own implementation of
> > > ISessionFactoryKeyProvider.
> > > I've made a pull request (https://github.com/sharparchitecture/Sharp-
> > > Architecture/pull/1) so hopefully this will make it into the mainline
> > > at some point in the future.
> > > These changes simplify adding multi-tenancy to an app. The
> > > MultiTenenatRepository from my post is no longer required and the
> > > binder should now work. The custom TransactionAttribute is also no
> > > longer required. The sample projecthttps://github.com/yellowfeather/SharpArchitecture-MultiTenant
> > > has been updated to use my forked version of S#arp Architecture.
> > > Blog post coming later in the week.
> > > Cheers,
> > > Chris
> > > On Jan 11, 6:05 pm, "Paul Hinett" <p...@ukcreativedesigns.com> wrote:
> > > > Hi,
> > > > I am setting up my project to use multi-tenancy from this fantastic article
> > > > which popped up today:
> > > >http://www.yellowfeather.co.uk/2011/01/multi-tenancy-on-sharp-archite...
> > > > However there is a problem which doesn't seemed to be addressed which is the
> > > > SharpModelBinder.
> > > > For the multi-tenant repositories to work they need to inherited from a
> > > > custom class called MultiTenantRepository<>.
> > > > However the SharpModelBinder uses it's own IRepositoryWithTypeId<>, is there
> > > > an easy way to override this without changing the Sharp source code and
> > > > re-compiling?
> > > > Thank you.
> > > > Paul
You received this message because you are subscribed to the Google Groups "S#arp Architecture" group.
To post to this group, send email to email@example.com.
To unsubscribe from this group, send email to firstname.lastname@example.org.
For more options, visit this group at http://groups.google.com/group/sharp-architecture?hl=en.