Esempio n. 1
0
        public static SQLServerClientService GetInstance(string connString = null)
        {
            SQLServerClientService instance = null;

            if (connString != null)
            {
                if (!instanceTable.TryGetValue(connString, out instance))
                {
                    instance = new SQLServerClientService(connString);
                    instanceTable.Add(connString, instance);
                }
            }
            else
            {
                connString = ConfigClass.JGet("SQLServerConnStr-local") as string;
                if (string.IsNullOrWhiteSpace(connString))
                {
                    return(null);
                }

                instance = new SQLServerClientService(connString);
                instanceTable.Add(connString, instance);
            }

            instance.stackCount += 1;
            return(instance);
        }
Esempio n. 2
0
        /// <summary>
        /// 使用注意:
        /// 1. redis增加/删除因为将会压入操作队列,所以不会立即生效,如果有必要,需要调用RedisCommit(),或最后Commit()一次。
        /// 2. 实体数据需要添加 TableName, DataBaseFields 两个属性才能正确使用SQL,Redis不影响
        /// </summary>
        public DataService()
        {
            if (sqlServer == null)
            {
                sqlServer = SQLServerClientService.GetInstance();
            }

            if (redis == null)
            {
                redis = RedisClientService.GetInstance();
            }
        }