This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM jetbrains/teamcity-agent | |
| ENV MONO_VERSION 5.4.1.6 | |
| RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF | |
| RUN apt install apt-transport-https | |
| RUN echo "deb http://download.mono-project.com/repo/ubuntu stable-xenial main" | tee /etc/apt/sources.list.d/mono-official-stable.list \ | |
| && apt-get update \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public interface IAccountAccessor { | |
| Account GetCurrentAccount(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class NancyContextAccountAccessor : IAccountAccessor { | |
| static readonly ILog _log = LogProvider.For<NancyContextAccountAccessor>(); | |
| readonly IAccountRepository _accountRepository; | |
| readonly NancyContext _nancyContext; | |
| public NancyContextAccountAccessor(IAccountRepository accountRepository, NancyContext nancyContext) { | |
| _accountRepository = accountRepository; | |
| _nancyContext = nancyContext; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class ClaimsPrincipalAccountAccessor : IAccountAccessor { | |
| static readonly ILog _log = LogProvider.For<ClaimsPrincipalAccountAccessor>(); | |
| readonly IAccountRepository _AccountRepository; | |
| readonly IOwinContext _owinContext; | |
| public ClaimsPrincipalAccountAccessor(IOwinContext owinContext, IAccountRepository accountRepository) { | |
| _owinContext = owinContext; | |
| _AccountRepository=accountRepository; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class HostnameAccountAccessor : IAccountAccessor { | |
| static readonly ILog _log = LogProvider.For<HostnameAccountAccessor>(); | |
| readonly IAccountRepository _AccountRepository; | |
| readonly IOwinContext _owinContext; | |
| Guid _instanceID; | |
| public Guid InstanceID { get { return _instanceID; } } | |
| public HostnameAccountAccessor(IOwinContext owinContext, IAccountRepository accountRepository) { | |
| _instanceID = Guid.NewGuid(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class NHibernateMultiTenantSessionSource : ISessionSource { | |
| #region Static Members and Constructor. | |
| static readonly object _FactorySyncRoot = new object(); | |
| static readonly ConcurrentDictionary<string, ISessionFactory> _SessionFactories = new ConcurrentDictionary<string, ISessionFactory>(); | |
| #endregion | |
| readonly IConfigurationReader _configurationManager; | |
| readonly IAccountAccessor _accountAccessor; | |
| readonly string _connectionStringModel; | |
| public NHibernateMultiTenantSessionSource(IConfigurationReader configurationManager, IAccountAccessor accountAccessor) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public interface IRepository<T> : IProject<T> where T : class, new() { | |
| T Get(int id); | |
| T GetFirst(Expression<Func<T, bool>> condition); | |
| IEnumerable<T> GetAll(); | |
| T SaveOrUpdate(T entity); | |
| IEnumerable<T> SaveOrUpdate(IEnumerable<T> entities); | |
| void Delete(T item); | |
| // other various operations on your repository of choice ... | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public abstract class Repository<T> : IRepository<T> { | |
| protected readonly ISessionSource _SessionSource; | |
| public Repository(ISessionSource sessionSource) { | |
| if (sessionSource == null) { | |
| throw new ArgumentNullException("sessionFactory"); | |
| } | |
| _SessionSource = sessionSource; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class NHibernateMultiTenantSessionSource : ISessionSource { | |
| #region Static Members and Constructor. | |
| static readonly object _FactorySyncRoot = new object(); | |
| static readonly ConcurrentDictionary<string, ISessionFactory> _SessionFactories = new ConcurrentDictionary<string, ISessionFactory>(); | |
| #endregion | |
| readonly IConfigurationReader _configurationManager; | |
| readonly IAccountAccessor _accountAccessor; | |
| readonly string _connectionStringModel; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public interface ISessionSource { | |
| ISession CreateSession(); | |
| } |