/// <summary>
        /// Initializes the data set infrastructure.
        /// </summary>
        private void Initialize()
        {
            if (BindingFactory == null)
            {
                throw new ArgumentNullException(nameof(BindingFactory));
            }
            if (EncodingFactory == null)
            {
                throw new ArgumentNullException(nameof(EncodingFactory));
            }
            if (MessageHandlerFactory == null)
            {
                throw new ArgumentNullException(nameof(MessageHandlerFactory));
            }
            if (ConfigurationFactory == null)
            {
                throw new ArgumentNullException(nameof(ConfigurationFactory));
            }
            DisposeMessageHandlersCollection();
            ConfigurationData _configuration = ConfigurationFactory.GetConfiguration();

            AssociationsCollection = AssociationsCollection.CreateAssociations(_configuration.DataSets, BindingFactory, EncodingFactory);
            ConfigurationFactory.OnAssociationConfigurationChange += AssociationsCollection.OnConfigurationChangeHandler;
            MessageHandlersCollection = MessageHandlersCollection.CreateMessageHandlers(_configuration.MessageHandlers, MessageHandlerFactory, EncodingFactory, AssociationsCollection.AddMessageHandler);
            ConfigurationFactory.OnMessageHandlerConfigurationChange += MessageHandlersCollection.OnConfigurationChangeHandler;
        }
        /// <summary>
        /// Creates the associations and populates the new dictionary with the associations instances created using the configuration <paramref name="configuration"/>.
        /// </summary>
        /// <param name="configuration">The configuration used to populate the collection.</param>
        /// <param name="bindingFactory">The binding factory responsible to create and return <see cref="IBinding"/> instance for each association.</param>
        /// <param name="encodingFactory">The encoding factory responsible to updated the created <see cref="IBinding"/> by provisioning all information necessary for encoding/decoding including <see cref="IValueConverter"/>.</param>
        /// <returns>New dictionary of type <see cref="AssociationsCollection"/>.</returns>
        /// <exception cref="System.ArgumentOutOfRangeException">Alias; Alias of any <see cref="Association"/> must be unique.</exception>
        internal static AssociationsCollection CreateAssociations(DataSetConfiguration[] configuration, IBindingFactory bindingFactory, IEncodingFactory encodingFactory)
        {
            AssociationsCollection _collection     = new AssociationsCollection();
            Association            _newAssociation = null;

            foreach (DataSetConfiguration _dataSet in configuration)
            {
                if (_collection.ContainsKey(_dataSet.AssociationName))
                {
                    throw new ArgumentOutOfRangeException("Alias", "Alias of any Association must be unique");
                }
                SemanticData _newSemanticData = new SemanticData(new Uri(_dataSet.InformationModelURI), _dataSet.DataSymbolicName, null, _dataSet.Id);
                switch (_dataSet.AssociationRole)
                {
                case AssociationRole.Consumer:
                    _newAssociation = new ConsumerAssociation(_newSemanticData, _dataSet, bindingFactory, encodingFactory);
                    break;

                case AssociationRole.Producer:
                    _newAssociation = new ProducerAssociation(_newSemanticData, _dataSet.AssociationName, _dataSet, bindingFactory, encodingFactory);
                    break;

                default:
                    break;
                }
                _collection.Add(_dataSet.AssociationName, _newAssociation);
            }
            return(_collection);
        }