private SqlSugarClient GetContext() { SqlSugarClient result = null; var key = _configs.GetHashCode().ToString(); StackTrace st = new StackTrace(true); var methods = st.GetFrames(); var isAsync = UtilMethods.IsAnyAsyncMethod(methods); if (isAsync) { result = GetAsyncContext(key); } else { result = GetThreadContext(key); } return(result); }
private SqlSugarProvider GetContext() { SqlSugarProvider result = null; if (IsSameThreadAndShard()) { result = SameThreadAndShard(); } else if (IsNoSameThreadAndShard()) { result = NoSameThreadAndShard(); } else if (IsSynchronization()) { result = Synchronization(); } else if (IsSingleInstanceAsync()) { result = Synchronization();//Async no support Single Instance } else if (IsAsync()) { result = Synchronization(); } else { StackTrace st = new StackTrace(true); var methods = st.GetFrames(); var isAsync = UtilMethods.IsAnyAsyncMethod(methods); if (isAsync) { result = Synchronization(); } else { result = NoSameThread(); } } if (result.Root == null) { result.Root = this; } return(result); }