/// <summary> /// Gets a single model under the context of the current user. /// </summary> /// <typeparam name="T">Type of Model</typeparam> /// <param name="id">Id of the Model</param> public T GetSingle <T>(int id) where T : Model { var logName = string.Format("for {0}.Id {1}", typeof(T).Name, id); this.Logger.AppendLine(string.Format("GetSingle started {0}", logName)); if (_securityContext == null) { throw new InvalidAccessTokenException(); } var sw = Stopwatch.StartNew(); var readHelper = new ReadHelper <T>(id, this); readHelper.Execute(); var model = readHelper.GetModel(); sw.Stop(); this.Logger.AppendLine(string.Format("GetSingle done {0}: {1} ms", logName, sw.ElapsedMilliseconds)); return(model); }