Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabling multi-tenancy #1

Merged
2 commits merged into from
Feb 8, 2011
Merged

Conversation

yellowfeather
Copy link

As part of my efforts to implement multi-tenancy on S#arp Architecture I have had to make some small modifications so that it is possible to get the session factory key by using a means other than attributes.

I have created an interface ISessionFactoryKeyProvider:

namespace SharpArch.Data.NHibernate
{
  public interface ISessionFactoryKeyProvider
  {
    /// <summary>
    /// Gets the session factory key.
    /// </summary>
    /// <returns></returns>
    string GetKey();

    /// <summary>
    /// Gets the session factory key.
    /// </summary>
    /// <param name="anObject">An optional object that may have an attribute used to determine the session factory key.</param>
    /// <returns></returns>
    string GetKeyFrom(object anObject);
  }
}

And a default implementation, DefaultSessionFactoryKeyProvider, that just delegates getting the key from the existing SessionFactoryAttribute. This implementation, or a custom implementation, now just needs registering in the container. I've updated the relevant code (EntityDuplicateChecker, RepositoryWithTypedId and TransactionAttribute) to use SessionFactoryKeyHelper rather than SessionFactoryAttribute.

Also, I've updated the template code to register the default implementation. However the template code seems to be different than the code in a recent project created using Templify?

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants