예제 #1
0
        // 쿼리 실행 완료 콜백
        private void OnExecutedQueries(DBInstance dBInstance, DBQueryBase[] queries, bool isSuccess)
        {
            foreach (DBQuery it in queries)
            {
                var qd = it.UserData as ReqQueryData;
                if (qd == null)
                {
                    continue;
                }

                lock (qd)
                {
                    qd.IsSuccess = isSuccess;
                    qd.FinishedQueries.Add(it);
                    if (qd.FinishedQueries.Count == qd.ReqQueries.Count)
                    {
                        lock (ReqQueryGroups)
                        {
                            ReqQueryGroups.Remove(qd.ContainerNode);
                        }
                        qd.ContainerNode = null;
                        lock (FinishedQueryGroups)
                        {
                            FinishedQueryGroups.Enqueue(qd);
                        }
                    }
                }
            }
        }
예제 #2
0
        public bool FromJSON(JToken token)
        {
            var dbInstances  = new Dictionary <DBType, DBInstance>();
            var jConnections = token["connections"];

            foreach (var jConnection in jConnections)
            {
                DBInstance dbInstance = new DBInstance();
                if (dbInstance.FromJSON(jConnection) == false)
                {
                    return(false);
                }

                DBType type;
                if (Enum.TryParse(dbInstance.Name, true, out type))
                {
                    dbInstances.Add(type, dbInstance);
                }
            }
            DBInstances = dbInstances;
            return(true);
        }