/// <summary>
        /// Create transaction from the given context.
        /// </summary>
        /// <param name="context">Transaction context.</param>
        /// <returns>Transaction.</returns>
        public ITransaction CreateTransaction(TContext context)
        {
            var repositoryBuilder = new RepositoryRegistryBuilder();

            registryConfigurator(context, repositoryBuilder);

            var repository = repositoryBuilder.Build();

            return(transactionProvider(context, repository));
        }
        /// <summary>
        /// Register repository provider.
        /// </summary>
        /// <typeparam name="TEntity">Type of entity.</typeparam>
        /// <param name="repositoryRegistryBuilder">Repository registry builder.</param>
        /// <param name="repositoryProvider">Repository provider.</param>
        public static RepositoryRegistryBuilder Register <TEntity>(
            this RepositoryRegistryBuilder repositoryRegistryBuilder,
            Func <IRepository <TEntity> > repositoryProvider)
            where TEntity : class
        {
            var repositoryKey = typeof(TEntity);

            repositoryRegistryBuilder.Register(new RepositoryRegistration(repositoryKey, new Lazy <object>(repositoryProvider)));

            return(repositoryRegistryBuilder);
        }