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?
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.
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 project https://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:
> 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 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.
<chris.richa...@yellowfeather.co.uk> wrote:
> 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:
> > 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?
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
NHibernateSession.DefaultFactoryKey.
Chris
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...@yellowfeather.co.uk> wrote:
> > 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:
> > > 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?
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.
<chris.richa...@yellowfeather.co.uk> wrote:
> 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
> NHibernateSession.DefaultFactoryKey.
> Chris
> 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...@yellowfeather.co.uk> wrote:
> > > 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:
> > > > 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?
We could include some of the core interfaces into the main SA project - if this makes it easier for the rest of the MT code to be a "bolt on feature" rather than a source code integration task?
On Thu, Jan 13, 2011 at 8:58 AM, Seif Attar <i...@seifattar.net> wrote: > 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.
> Chris
> On Jan 12, 11:29 pm, Chris Richards > <chris.richa...@yellowfeather.co.uk> wrote: > > 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 > > NHibernateSession.DefaultFactoryKey.
> > Chris
> > 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.
> > > > 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.
> > > > 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:
> > > > > 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 sharp-architecture@googlegroups.com. > To unsubscribe from this group, send email to > sharp-architecture+unsubscribe@googlegroups.com<sharp-architecture%2Bunsubs cribe@googlegroups.com>.
> -- > You received this message because you are subscribed to the Google Groups > "S#arp Architecture" group. > To post to this group, send email to sharp-architecture@googlegroups.com. > To unsubscribe from this group, send email to > sharp-architecture+unsubscribe@googlegroups.com<sharp-architecture%2Bunsubs cribe@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/sharp-architecture?hl=en.
I've just pushed some updates to my sample app so that the correct
session factory key is used for standard and multi tenant repositories
(by using reflection and the IMultiTenantEntity and
IMultiTenantRepository marker interfaces).
Also, I've reorganised the code slightly which would make it easier to
add to contrib if desired (just add everything in the
SharpArchitecture.MultiTenant.Framework project). The changes to the
main SA in my pull request (https://github.com/sharparchitecture/Sharp- Architecture/pull/1) would be required though.
On Jan 13, 9:46 am, Howard van Rooijen <howard.vanrooi...@gmail.com>
wrote:
> We could include some of the core interfaces into the main SA project - if
> this makes it easier for the rest of the MT code to be a "bolt on feature"
> rather than a source code integration task?
> On Thu, Jan 13, 2011 at 8:58 AM, Seif Attar <i...@seifattar.net> wrote:
> > 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.
> > Chris
> > On Jan 12, 11:29 pm, Chris Richards
> > <chris.richa...@yellowfeather.co.uk> wrote:
> > > 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
> > > NHibernateSession.DefaultFactoryKey.
> > > Chris
> > > 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.
> > > > > 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.
> > > > > 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:
> > > > > > 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 sharp-architecture@googlegroups.com.
> > To unsubscribe from this group, send email to
> > sharp-architecture+unsubscribe@googlegroups.com<sharp-architecture%2Bunsubs cribe@googlegroups.com>.
> > --
> > You received this message because you are subscribed to the Google Groups
> > "S#arp Architecture" group.
> > To post to this group, send email to sharp-architecture@googlegroups.com.
> > To unsubscribe from this group, send email to
> > sharp-architecture+unsubscribe@googlegroups.com<sharp-architecture%2Bunsubs cribe@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/sharp-architecture?hl=en.
chris.richa...@yellowfeather.co.uk> wrote: > I've just pushed some updates to my sample app so that the correct > session factory key is used for standard and multi tenant repositories > (by using reflection and the IMultiTenantEntity and > IMultiTenantRepository marker interfaces).
> Also, I've reorganised the code slightly which would make it easier to > add to contrib if desired (just add everything in the > SharpArchitecture.MultiTenant.Framework project). The changes to the > main SA in my pull request (https://github.com/sharparchitecture/Sharp- > Architecture/pull/1) would be required though.
> On Jan 13, 9:46 am, Howard van Rooijen <howard.vanrooi...@gmail.com> > wrote: > > We could include some of the core interfaces into the main SA project - > if > > this makes it easier for the rest of the MT code to be a "bolt on > feature" > > rather than a source code integration task?
> > On Thu, Jan 13, 2011 at 8:58 AM, Seif Attar <i...@seifattar.net> wrote: > > > 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.
> > > Chris
> > > On Jan 12, 11:29 pm, Chris Richards > > > <chris.richa...@yellowfeather.co.uk> wrote: > > > > 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 > > > > NHibernateSession.DefaultFactoryKey.
> > > > Chris
> > > > 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.
> > > > > > 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.
> > > > > > 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:
> > > > > > > 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 > sharp-architecture@googlegroups.com. > > > To unsubscribe from this group, send email to > > > sharp-architecture+unsubscribe@googlegroups.com<sharp-architecture%2Bunsubs cribe@googlegroups.com><sharp-architecture%2Bunsubs > cribe@googlegroups.com>.
> > > -- > > > You received this message because you are subscribed to the Google > Groups > > > "S#arp Architecture" group. > > > To post to this group, send email to > sharp-architecture@googlegroups.com. > > > To unsubscribe from this group, send email to > > > sharp-architecture+unsubscribe@googlegroups.com<sharp-architecture%2Bunsubs cribe@googlegroups.com><sharp-architecture%2Bunsubs > cribe@googlegroups.com> > > > . > > > For more options, visit this group at > > >http://groups.google.com/group/sharp-architecture?hl=en.
> -- > You received this message because you are subscribed to the Google Groups > "S#arp Architecture" group. > To post to this group, send email to sharp-architecture@googlegroups.com. > To unsubscribe from this group, send email to > sharp-architecture+unsubscribe@googlegroups.com<sharp-architecture%2Bunsubs cribe@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/sharp-architecture?hl=en.
> On Thu, Jan 13, 2011 at 6:52 AM, Chris Richards <
> chris.richa...@yellowfeather.co.uk> wrote:
> > I've just pushed some updates to my sample app so that the correct
> > session factory key is used for standard and multi tenant repositories
> > (by using reflection and the IMultiTenantEntity and
> > IMultiTenantRepository marker interfaces).
> > Also, I've reorganised the code slightly which would make it easier to
> > add to contrib if desired (just add everything in the
> > SharpArchitecture.MultiTenant.Framework project). The changes to the
> > main SA in my pull request (https://github.com/sharparchitecture/Sharp- > > Architecture/pull/1) would be required though.
> > On Jan 13, 9:46 am, Howard van Rooijen <howard.vanrooi...@gmail.com>
> > wrote:
> > > We could include some of the core interfaces into the main SA project -
> > if
> > > this makes it easier for the rest of the MT code to be a "bolt on
> > feature"
> > > rather than a source code integration task?
> > > On Thu, Jan 13, 2011 at 8:58 AM, Seif Attar <i...@seifattar.net> wrote:
> > > > 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.
> > > > Chris
> > > > On Jan 12, 11:29 pm, Chris Richards
> > > > <chris.richa...@yellowfeather.co.uk> wrote:
> > > > > 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
> > > > > NHibernateSession.DefaultFactoryKey.
> > > > > Chris
> > > > > 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.
> > > > > > > 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:
> > > > > > > > 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
> > sharp-architecture@googlegroups.com.
> > > > To unsubscribe from this group, send email to
> > > > sharp-architecture+unsubscribe@googlegroups.com<sharp-architecture%2Bunsubs cribe@googlegroups.com><sharp-architecture%2Bunsubs
> > cribe@googlegroups.com>.
> > > > --
> > > > You received this message because you are subscribed to the Google
> > Groups
> > > > "S#arp Architecture" group.
> > > > To post to this group, send email to
> > sharp-architecture@googlegroups.com.
> > > > To unsubscribe from this group, send email to
> > > > sharp-architecture+unsubscribe@googlegroups.com<sharp-architecture%2Bunsubs cribe@googlegroups.com><sharp-architecture%2Bunsubs
> > cribe@googlegroups.com>
> > > > .
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/sharp-architecture?hl=en.
> > --
> > You received this message because you are subscribed to the Google Groups
> > "S#arp Architecture" group.
> > To post to this group, send email to sharp-architecture@googlegroups.com.
> > To unsubscribe from this group, send email to
> > sharp-architecture+unsubscribe@googlegroups.com<sharp-architecture%2Bunsubs cribe@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/sharp-architecture?hl=en.
Chris, the team is meeting on Sunday, we will discuss then the best way for us to adapt this. I think our current plan is to take part of it into S# and the other part into contrib. We'll let you know shortly.
chris.richa...@yellowfeather.co.uk> wrote: > What's the best way of proceeding?
> My existing pull request is against SA 1.9, do you want me to merge my > changes into 2.0 and send another pull request?
> On Jan 13, 4:53 pm, Alec Whittington <alec.whitting...@gmail.com> > wrote: > > I think this would be a most welcome addition to the S# code base. I > agree > > with Howard that some of it can go into the core bits.
> > On Thu, Jan 13, 2011 at 6:52 AM, Chris Richards <
> > chris.richa...@yellowfeather.co.uk> wrote: > > > I've just pushed some updates to my sample app so that the correct > > > session factory key is used for standard and multi tenant repositories > > > (by using reflection and the IMultiTenantEntity and > > > IMultiTenantRepository marker interfaces).
> > > Also, I've reorganised the code slightly which would make it easier to > > > add to contrib if desired (just add everything in the > > > SharpArchitecture.MultiTenant.Framework project). The changes to the > > > main SA in my pull request ( > https://github.com/sharparchitecture/Sharp- > > > Architecture/pull/1) would be required though.
> > > On Jan 13, 9:46 am, Howard van Rooijen <howard.vanrooi...@gmail.com> > > > wrote: > > > > We could include some of the core interfaces into the main SA project > - > > > if > > > > this makes it easier for the rest of the MT code to be a "bolt on > > > feature" > > > > rather than a source code integration task?
> > > > On Thu, Jan 13, 2011 at 8:58 AM, Seif Attar <i...@seifattar.net> > wrote: > > > > > 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.
> > > > > Chris
> > > > > On Jan 12, 11:29 pm, Chris Richards > > > > > <chris.richa...@yellowfeather.co.uk> wrote: > > > > > > 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 > > > > > > NHibernateSession.DefaultFactoryKey.
> > > > > > Chris
> > > > > > 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.
> > > > > > > > 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.
> > > > > > > > > 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 > > > sharp-architecture@googlegroups.com. > > > > > To unsubscribe from this group, send email to > > > > > sharp-architecture+unsubscribe@googlegroups.com<sharp-architecture%2Bunsubs cribe@googlegroups.com><sharp-architecture%2Bunsubs > cribe@googlegroups.com><sharp-architecture%2Bunsubs > > > cribe@googlegroups.com>.
> > > > > -- > > > > > You received this message because you are subscribed to the Google > > > Groups > > > > > "S#arp Architecture" group. > > > > > To post to this group, send email to > > > sharp-architecture@googlegroups.com. > > > > > To unsubscribe from this group, send email to > > > > > sharp-architecture+unsubscribe@googlegroups.com<sharp-architecture%2Bunsubs cribe@googlegroups.com><sharp-architecture%2Bunsubs > cribe@googlegroups.com><sharp-architecture%2Bunsubs > > > cribe@googlegroups.com> > > > > > . > > > > > For more options, visit this group at > > > > >http://groups.google.com/group/sharp-architecture?hl=en.
> > > -- > > > You received this message because you are subscribed to the Google > Groups > > > "S#arp Architecture" group. > > > To post to this group, send email to > sharp-architecture@googlegroups.com. > > > To unsubscribe from this group, send email to > > > sharp-architecture+unsubscribe@googlegroups.com<sharp-architecture%2Bunsubs cribe@googlegroups.com><sharp-architecture%2Bunsubs > cribe@googlegroups.com> > > > . > > > For more options, visit this group at > > >http://groups.google.com/group/sharp-architecture?hl=en.
> -- > You received this message because you are subscribed to the Google Groups > "S#arp Architecture" group. > To post to this group, send email to sharp-architecture@googlegroups.com. > To unsubscribe from this group, send email to > sharp-architecture+unsubscribe@googlegroups.com<sharp-architecture%2Bunsubs cribe@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/sharp-architecture?hl=en.