/************************ Construction ***********************************/ /*----------------------- GitContext ------------------------------------*/ /// <summary> /// Injection constructor /// </summary> /// <param name="localFactory"> /// Local repository factory /// </param> /// <param name="remoteFactory"> /// Remote repository factory /// </param> /// <param name="gitExec"> /// Git executor /// </param> /// <param name="lfsExec"> /// LFS executor /// </param> public GitContext( IGitCacheConfiguration gitCacheConfiguration, ILocalRepositoryFactory localFactory, IRemoteRepositoryFactory remoteFactory, IGitExecuter gitExec, IGitLFSExecuter lfsExec) { if (null == (Configuration = gitCacheConfiguration)) { throw new ArgumentNullException(nameof(gitCacheConfiguration), "Missing git-cache configuration"); } if (null == (LocalFactory = localFactory)) { throw new ArgumentNullException(nameof(localFactory), "Missing required local repository factory"); } if (null == (RemoteFactory = remoteFactory)) { throw new ArgumentNullException(nameof(remoteFactory), "Remote repository factory must be valid"); } if (null == (GitExecuter = gitExec)) { throw new ArgumentNullException(nameof(gitExec), "Git executor must be valid"); } if (null == (LFSExecuter = lfsExec)) { throw new ArgumentNullException(nameof(lfsExec), "LFS executor must be valid"); } } /* End of Function - GitContext */
/// <summary> /// Construct a <see cref="LocalRepositoryManager"/> /// </summary> /// <param name="ioManager">The value of <see cref="ioManager"/></param> /// <param name="localRepositoryFactory">The value of <see cref="localRepositoryFactory"/></param> /// <param name="repositoryOperations">The value of <see cref="repositoryOperations"/></param> /// <param name="logger">The value of <see cref="logger"/></param> public LocalRepositoryManager(IIOManager ioManager, ILocalRepositoryFactory localRepositoryFactory, IRepositoryOperations repositoryOperations, ILogger <LocalRepositoryManager> logger) { this.ioManager = new ResolvingIOManager(ioManager ?? throw new ArgumentNullException(nameof(ioManager)), "Repositories"); this.localRepositoryFactory = localRepositoryFactory ?? throw new ArgumentNullException(nameof(localRepositoryFactory)); this.repositoryOperations = repositoryOperations ?? throw new ArgumentNullException(nameof(repositoryOperations)); this.logger = logger ?? throw new ArgumentNullException(nameof(logger)); activeRepositories = new Dictionary <string, Task>(); }