Esempio n. 1
0
        public static DataBaseWorkerQueue GetQueue(string connectionStringName, IDataBaseProvider dataBaseProvider)
        {
            lock (_instances)
            {
                DataBaseWorkerQueue returnValue;
                if (!_instances.ContainsKey(dataBaseProvider))
                {
                    _instances.Add(dataBaseProvider, new DataBaseWorkerQueue[] { returnValue = new DataBaseWorkerQueue(connectionStringName, dataBaseProvider) }.ToDictionary(x => connectionStringName));
                }
                else if (!_instances[dataBaseProvider].ContainsKey(connectionStringName))
                {
                    _instances[dataBaseProvider].Add(connectionStringName, returnValue = new DataBaseWorkerQueue(connectionStringName, dataBaseProvider));
                }
                else
                {
                    returnValue = _instances[dataBaseProvider][connectionStringName];
                }

                return(returnValue);
            }
        }
Esempio n. 2
0
 public DataBaseWorker(string connectionStringName, InheritensObjectProvider <T> objectProvider)
 {
     _objectProvider = objectProvider;
     _queue          = DataBaseWorkerQueue.GetQueue(_connectionStringName = connectionStringName, objectProvider._databaseProvider);
 }