Ejemplo n.º 1
0
        /// <summary>
        /// Creates an <see cref="IAdoResourceProvider" /> that deals with connection
        /// sharing where a number of workflow services share the same connection
        /// String.
        /// </summary>
        /// <param name="connectionStringSettings">
        /// <see cref="ConnectionStringSettings" /> containing the connection string settings.
        /// </param>
        /// <returns>
        /// An <see cref="IAdoResourceProvider" /> implementation.
        /// </returns>
        public IAdoResourceProvider CreateResourceProvider(ConnectionStringSettings connectionStringSettings)
        {
            String connectionStringKey = String.Format("{0}_{1}",
                                                       connectionStringSettings.ProviderName,
                                                       connectionStringSettings.ConnectionString);

            IAdoResourceProvider resourceProvider;

            if (!resourceProvidersByConnectionString.TryGetValue(connectionStringKey, out resourceProvider))
            {
                lock (resourceProviderLock)
                {
                    if (!resourceProvidersByConnectionString.TryGetValue(connectionStringKey, out resourceProvider))
                    {
                        resourceProvider = new AdoResourceProviderWrapper(this, connectionStringSettings);
                        resourceProvidersByConnectionString.Add(connectionStringKey, resourceProvider);
                    }
                }
            }

            return(resourceProvider);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates an <see cref="IAdoResourceProvider" /> that deals with connection
        /// sharing where a number of workflow services share the same connection
        /// String.
        /// </summary>
        /// <param name="connectionStringSettings">
        /// <see cref="ConnectionStringSettings" /> containing the connection string settings.
        /// </param>
        /// <returns>
        /// An <see cref="IAdoResourceProvider" /> implementation.
        /// </returns>
        public IAdoResourceProvider CreateResourceProvider(ConnectionStringSettings connectionStringSettings)
        {
            String connectionStringKey = String.Format("{0}_{1}",
                connectionStringSettings.ProviderName,
                connectionStringSettings.ConnectionString);

            IAdoResourceProvider resourceProvider;
            if (!resourceProvidersByConnectionString.TryGetValue(connectionStringKey, out resourceProvider))
            {
                lock (resourceProviderLock)
                {
                    if (!resourceProvidersByConnectionString.TryGetValue(connectionStringKey, out resourceProvider))
                    {
                        resourceProvider = new AdoResourceProviderWrapper(this, connectionStringSettings);
                        resourceProvidersByConnectionString.Add(connectionStringKey, resourceProvider);
                    }
                }
            }

            return resourceProvider;
        }