예제 #1
0
        /// <summary>
        /// Adds a repository registration.
        /// </summary>
        /// <typeparam name="T">The repository type.</typeparam>
        /// <param name="container">The Castle Windsor container.</param>
        /// <param name="repositoryType">Type of the repository.</param>
        public static void RegisterRepository <T>(WindsorContainer container, Type repositoryType) where T : class
        {
            Guard.Will.ThrowExceptionOfType <LeadPipeNetDataException>("The container has not been initialized. Did you call the LeadPipeNHibernateDataConfiguration.Initialize method first?").When(container.IsNull());

            container.Register(Component.For(typeof(IRepository <T>)).ImplementedBy(repositoryType).LifestyleScoped());
        }