public virtual async Task <T> GetAsync(int id, [CallerLineNumber] int lineNumber = 0, [CallerMemberName] string caller = null) { T item = null; item = await _cache?.FindFirstAsync(id.ToString()); if (item == null) { return(item); } item = await _dbSet.FindAsync(id); return(item); }
//public async T #endregion #region Read public async Task <T> GetAsync(int id, [CallerLineNumber] int lineNumber = 0, [CallerMemberName] string caller = null) { Stopwatch watch = new Stopwatch(); try { watch.Start(); T item = null; item = await _cache?.FindFirstAsync(id.ToString()); if (item == null) { return(item); } item = await _dbSet.FindAsync(id); watch.Stop(); Logging("Get", watch.ElapsedMilliseconds, lineNumber, caller, id); return(item); } catch (Exception ext) { watch.Stop(); ErrorLogging("AddAsync Error", watch.ElapsedMilliseconds, id, ext, caller, lineNumber); return(null); } }