Exemple #1
0
        /// <summary>
        /// The unique identifier for the service owner. This property will attempt to return
        /// a cached value, if possible.
        /// </summary>
        public async Task <Guid> GetInstanceTypeAsync(
            CancellationToken cancellationToken = default(CancellationToken))
        {
            if (!NeedToConnect(ConnectOptions.None))
            {
                // We've already made a Connect call and have the authoritative service owner ID.
                return(m_serviceOwner);
            }
            else
            {
                ServerMapData serverData = LocationServerMapCache.ReadServerData(m_fullyQualifiedUrl);
                Guid          toReturn   = serverData.ServiceOwner;

                if (Guid.Empty != toReturn)
                {
                    // We do. Return it.
                    return(toReturn);
                }

                // We do not. Make a Connect call and retrieve the service owner ID.
                await EnsureConnectedAsync(ConnectOptions.None, cancellationToken).ConfigureAwait(false);

                return(m_serviceOwner);
            }
        }
Exemple #2
0
        public VssServerDataProvider(
            VssConnection connection,
            HttpMessageHandler pipeline,
            String fullyQualifiedUrl)
        {
            m_connection        = connection;
            m_baseUri           = connection.Uri;
            m_fullyQualifiedUrl = fullyQualifiedUrl;
            m_locationClient    = new LocationHttpClient(m_baseUri, pipeline, false);

            // Try to get the guid for this server
            ServerMapData serverData = LocationServerMapCache.ReadServerData(m_fullyQualifiedUrl);

            m_locationDataCacheManager = new LocationCacheManager(serverData.ServerId, serverData.ServiceOwner, m_baseUri);
        }