Exemplo n.º 1
0
        public async Task <IModelService> CreateAsync(IConnection connection)
        {
            ModelService result;

            await cacheLock.WaitAsync();

            try
            {
                if (!cache.TryGetValue(connection, out result))
                {
                    result = new ModelService(
                        await apiClientFactory.Create(connection.HostAddress),
                        await hostCacheFactory.Create(connection.HostAddress),
                        avatarProvider);
                    result.InsertUser(AccountCacheItem.Create(connection.User));
                    cache.Add(connection, result);
                }
            }
            finally
            {
                cacheLock.Release();
            }

            return(result);
        }
Exemplo n.º 2
0
        public IRepositoryHost Create(HostAddress hostAddress)
        {
            var apiClient    = apiClientFactory.Create(hostAddress);
            var hostCache    = hostCacheFactory.Create(hostAddress);
            var modelService = new ModelService(apiClient, hostCache, avatarProvider);

            return(new RepositoryHost(apiClient, modelService, loginCache, twoFactorChallengeHandler));
        }
Exemplo n.º 3
0
        public async Task <IRepositoryHost> Create(HostAddress hostAddress)
        {
            var apiClient = await apiClientFactory.Create(hostAddress);

            var hostCache    = hostCacheFactory.Create(hostAddress);
            var modelService = new ModelService(apiClient, hostCache, avatarProvider);
            var host         = new RepositoryHost(apiClient, modelService, loginManager, loginCache, usage);

            hosts.Add(host);
            return(host);
        }