Пример #1
0
 public ScmController(IRepositoryManager repositoryManager,
                      IHgServer server)
 {
     _repositoryManager = repositoryManager;
     _repository = repositoryManager.GetRepository() ?? NullRepository.Instance;
     _server = server;
 }
Пример #2
0
        public void Deploy()
        {
            var repository = _repositoryManager.GetRepository();

            if (repository == null)
            {
                return;
            }

            Branch activeBranch = repository.GetBranches().FirstOrDefault(b => b.Active);
            string id           = repository.CurrentId;

            if (activeBranch != null)
            {
                repository.Update(activeBranch.Name);
            }
            else
            {
                repository.Update(id);
            }

            Deploy(id);
        }
Пример #3
0
        /// <summary>
        /// Creates an <see cref="IDynamicApiAction"/> for a repository action.
        /// </summary>
        public IDynamicApiAction CreateRepositoryAction(IRepositoryManager repositoryManager, DynamicApiRequest request)
        {
            if (repositoryManager == null)
            {
                return(null);
            }

            var repositoryName = request.RequestedActionPath.RequestedController;
            var repository     = repositoryManager.GetRepository(repositoryName);

            if (repository == null)
            {
                return(null);
            }

            var actionName = request.RequestedActionPath.RequestedAction;

            if (actionName == "getitem")
            {
                actionName = "get_item";
            }

            var method = repository
                         .GetType()
                         .GetMethods()
                         .FirstOrDefault(e => e.Name.Equals(actionName, StringComparison.InvariantCultureIgnoreCase));

            var interfaceMethod = GetInterfaceMethod(repository, actionName);

            if (method == null || interfaceMethod == null)
            {
                return(null);
            }
            DynamicApiRepositoryAction action = CreateAction(repositoryManager, repositoryName, actionName, method, interfaceMethod);

            return(action);
        }
Пример #4
0
 /// <summary>
 /// Gets a repository by its interface
 /// </summary>
 /// <typeparam name="TInterface"></typeparam>
 /// <returns></returns>
 protected TInterface GetRepository <TInterface>() where TInterface : IRepository
 {
     return(_repositoryManager.GetRepository <TInterface>());
 }
 public static ItemOptionType GetPersistentOf(this ItemOptionType optionType, IRepositoryManager repositoryManager)
 {
     return(repositoryManager.GetRepository <ItemOptionType>().GetById(optionType.Id));
 }
 public static AttributeDefinition GetPersistentOf(this AttributeDefinition attributeDefinition, IRepositoryManager repositoryManager)
 {
     return(repositoryManager.GetRepository <AttributeDefinition>().GetById(attributeDefinition.Id));
 }
Пример #7
0
 public ScmController(IRepositoryManager repositoryManager)
 {
     _repositoryManager = repositoryManager;
     _repository        = repositoryManager.GetRepository() ?? NullRepository.Instance;
 }
Пример #8
0
 public ScmController(IRepositoryManager repositoryManager)
 {
     _repositoryManager = repositoryManager;
     _repository = repositoryManager.GetRepository() ?? NullRepository.Instance;
 }
Пример #9
0
 public AuthController(IRepositoryManager repositoryManager)
 {
     _repositoryManager = repositoryManager;
     _userRepository    = repositoryManager.GetRepository <IUserRepository>();
 }