Inheritance: AbstractSchemaRepositoryFactory
        protected virtual AbstractEntityRepository CreateEntityRepository(bool isReadOnly)
        {
            if (NhDependencyHelper == null)
            {
                var extra = "(null)";

                if (DependencyHelper != null)
                {
                    extra = DependencyHelper.GetType().Name;
                    if (DependencyHelper.ProviderMetadata != null)
                    {
                        extra += " with key " + DependencyHelper.ProviderMetadata.Alias.IfNullOrWhiteSpace("(no key)");
                    }
                }

                throw new NullReferenceException("NhDependencyHelper is null and DependencyHelper is " + extra);
            }

            if (NhDependencyHelper.FactoryHelper == null)
            {
                throw new NullReferenceException("NhDependencyHelper.FactoryHelper is null");
            }

            ISession session;
            var      transaction = NhDependencyHelper.FactoryHelper.GenerateSessionAndTransaction(isReadOnly, out session);

            var schemaRepository = NhSchemaRepositoryFactory != null
                                       ? NhSchemaRepositoryFactory.GetRepository(transaction, isReadOnly)
                                       : SchemaRepositoryFactory.GetRepository();

            var revisionRepository = NhRevisionRepositoryFactory != null
                                         ? NhRevisionRepositoryFactory.GetRepository(transaction, isReadOnly)
                                         : RevisionRepositoryFactory.GetRepository();

            return(new EntityRepository(ProviderMetadata, schemaRepository, revisionRepository, transaction, session, FrameworkContext, isReadOnly));
        }
 /// <summary>
 /// Handles the disposal of resources. Derived from abstract class <see cref="DisposableObject"/> which handles common required locking logic.
 /// </summary>
 protected override void DisposeResources()
 {
     RevisionRepositoryFactory.Dispose();
     SchemaRepositoryFactory.Dispose();
     DependencyHelper.Dispose();
 }