Defines a single endpoint for a microservices client
        /// <summary> Add a new single endpoint to this configuration </summary>
        /// <param name="Key"> Key used for subsequent lookups from this configuration </param>
        /// <param name="URL"> Complete URL for this microservices endpoint </param>
        /// <param name="Protocol"> Protocol to use when connecting to this endpoint, via the URL ( JSON or ProtoBuf ) </param>
        public void Add_Endpoint(string Key, string URL, string Protocol)
        {
            // Build the endpoint object
            MicroservicesClient_Endpoint endpoint = new MicroservicesClient_Endpoint(Key, URL, Protocol);

            // Add this endpoint
            Add_Endpoint(Key, endpoint);
        }
        // ReSharper disable UnusedMember.Local

        private object ExampleGetMethod(int PrimaryKey, Custom_Tracer Tracer)
        {
            // Get the endpoint
            MicroservicesClient_Endpoint endpoint = GetEndpointConfig("ConfigUrl1", Tracer);

            Tracer.Add_Trace("ExamplePostMethod", "Calling microservice endpoint at: " + endpoint.URL);

            // Call out to the endpoint and return the deserialized object
            return(Deserialize <object>(String.Format(endpoint.URL, PrimaryKey), endpoint.Protocol, Tracer));
        }
        /// <summary> Gets the endpoint information from the microservices client configuration </summary>
        /// <param name="Key"> Lookup key for this configuration information </param>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
        /// <returns> Requested endpoint client configuration, or throws an ApplicationException </returns>
        /// <exception cref="ApplicationException"> If the key is not present in the configuration, an exception is thrown with the message
        /// 'No microservice endpoint defined in the client application for key'. </exception>
        protected MicroservicesClient_Endpoint GetEndpointConfig(string Key, Custom_Tracer Tracer)
        {
            MicroservicesClient_Endpoint endpoint = Config[Key];

            if (endpoint == null)
            {
                if (Tracer != null)
                {
                    Tracer.Add_Trace("MicroservicesClientBase.GetEndpointConfig", "No microservice endpoint defined in the client application for key '" + Key + "'", Custom_Trace_Type_Enum.Error);
                }
                throw new ApplicationException("No microservice endpoint defined in the client application for key '" + Key + "'");
            }

            return(endpoint);
        }
        private string ExamplePostMethod(string UserId, object RemoveObject, Custom_Tracer Tracer)
        {
            // Get the endpoint
            MicroservicesClient_Endpoint endpoint = GetEndpointConfig("ConfigUrl1", Tracer);

            // Create the post data
            List <KeyValuePair <string, string> > postData = new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("UserId", UserId),
                new KeyValuePair <string, string>("RemoveObject", JSON.Serialize(RemoveObject))
            };

            Tracer.Add_Trace("ExamplePostMethod", "Calling microservice endpoint at: " + endpoint.URL);

            // Call out to the endpoint and return the deserialized object
            return(Deserialize <string>(endpoint.URL, endpoint.Protocol, postData, "POST", Tracer));
        }
        /// <summary> Add a new single endpoint to this configuration </summary>
        /// <param name="Key"> Key used for subsequent lookups from this configuration </param>
        /// <param name="Endpoint"> Fully pre-constructed microservice client endpoint configuration object </param>
        public void Add_Endpoint(string Key, MicroservicesClient_Endpoint Endpoint)
        {
            // Check and build the dictionary as needed
            build_dictionary();

            // If a value already exists for this key, remove it from the list
            if (endpointsDictionary.ContainsKey(Key))
            {
                MicroservicesClient_Endpoint foundEndpoint = endpointsDictionary[Key];
                if (Endpoints.Contains(foundEndpoint))
                {
                    Endpoints.Remove(foundEndpoint);
                }
            }

            // Add this new value
            Endpoints.Add(Endpoint);
            endpointsDictionary[Key] = Endpoint;
        }
        /// <summary> Reference a single microservices client endpoint configuration, via the lookup key </summary>
        /// <param name="Key"> Key to find the microservices client endpoint configuration </param>
        /// <returns> Specified microservices client endpoint configuration, or NULL </returns>
        public MicroservicesClient_Endpoint this[string Key]
        {
            get
            {
                // Check and build the dictionary as needed
                build_dictionary();

                // If no endpoint, return
                if (Endpoints.Count == 0)
                {
                    return(null);
                }

                // (endpoints dictionary ensured to be built now).. return endpoint by key
                return(endpointsDictionary.ContainsKey(Key) ? endpointsDictionary[Key] : null);
            }
            set
            {
                // Check and build the dictionary as needed
                build_dictionary();

                // If a value already exists for this key, remove it from the list
                if (endpointsDictionary.ContainsKey(Key))
                {
                    MicroservicesClient_Endpoint foundEndpoint = endpointsDictionary[Key];
                    if (Endpoints.Contains(foundEndpoint))
                    {
                        Endpoints.Remove(foundEndpoint);
                    }
                }

                // Add this new value
                Endpoints.Add(value);
                endpointsDictionary[Key] = value;
            }
        }
 /// <summary> Add a new single endpoint to this configuration </summary>
 /// <param name="Key"> Key used for subsequent lookups from this configuration </param>
 /// <param name="Endpoint"> Fully pre-constructed microservice client endpoint configuration object </param>
 public void Add_Endpoint(string Key, MicroservicesClient_Endpoint Endpoint)
 {
     endpoints[Key] = Endpoint;
 }
        /// <summary> Add a new single endpoint to this configuration </summary>
        /// <param name="Key"> Key used for subsequent lookups from this configuration </param>
        /// <param name="Endpoint"> Fully pre-constructed microservice client endpoint configuration object </param>
        public void Add_Endpoint(string Key, MicroservicesClient_Endpoint Endpoint)
        {
            // Check and build the dictionary as needed
            build_dictionary();

            // If a value already exists for this key, remove it from the list
            if (endpointsDictionary.ContainsKey(Key))
            {
                MicroservicesClient_Endpoint foundEndpoint = endpointsDictionary[Key];
                if (Endpoints.Contains(foundEndpoint))
                    Endpoints.Remove(foundEndpoint);
            }

            // Add this new value
            Endpoints.Add(Endpoint);
            endpointsDictionary[Key] = Endpoint;
        }
        /// <summary> Add a new single endpoint to this configuration </summary>
        /// <param name="Key"> Key used for subsequent lookups from this configuration </param>
        /// <param name="URL"> Complete URL for this microservices endpoint </param>
        /// <param name="Protocol"> Protocol to use when connecting to this endpoint, via the URL ( JSON or ProtoBuf ) </param>
        public void Add_Endpoint(string Key, string URL, string Protocol)
        {
            // Build the endpoint object
            MicroservicesClient_Endpoint endpoint = new MicroservicesClient_Endpoint(Key, URL, Protocol);

            // Add this endpoint
            Add_Endpoint(Key, endpoint);
        }
 /// <summary> Add a new single endpoint to this configuration </summary>
 /// <param name="Key"> Key used for subsequent lookups from this configuration </param>
 /// <param name="Endpoint"> Fully pre-constructed microservice client endpoint configuration object </param>
 public void Add_Endpoint(string Key, MicroservicesClient_Endpoint Endpoint)
 {
     endpoints[Key] = Endpoint;
 }