private static bool Add(string id, Connectionx connx) { if (_cache.ContainsKey(id)) { return(false); } return(_cache.TryAdd(id, connx)); }
public static bool BeginTransaction(string id, IsolationLevel isolationLevel) { var conn = new Connectionx(id, isolationLevel); if (conn.BeginTransction()) { Add(id.ToString(), conn); _threadLocal.Value = id; Console.WriteLine("tranx had started, connection id : " + id); return(true); } conn.Dispose(); return(false); }