private readonly Guid _userId; //#A public EfCoreContext(DbContextOptions <EfCoreContext> options, //#B IUserIdService userIdService = null) //#C : base(options) { _userId = userIdService?.GetUserId() //#D ?? new ReplacementUserIdService().GetUserId(); //#D }
public OrderDbContext(DbContextOptions <OrderDbContext> options, IUserIdService userIdService = null) : base(options) { UserId = userIdService?.GetUserId() ?? new ReplacementUserIdService().GetUserId(); }
public virtual async Task <IActionResult> Get(string query = null, int page = 0, int pageSize = 20, CancellationToken cancel = default) { var userId = UserIdService.GetUserId(User); ListResponse <TDto> results; if (string.IsNullOrEmpty(query)) { results = await Service.GetAsync(userId, page, pageSize, cancel); } else { results = await Service.SearchAsync(query, userId, page, pageSize, cancel); } return(Ok(results)); }
private void InitializeTracker() { Log.Debug("Initializing tracker"); if (string.IsNullOrWhiteSpace(AccountId)) { Log.Warning("Account Id is null or whitespace, cannot create tracker"); return; } if (string.IsNullOrWhiteSpace(UserId)) { Log.Debug("User Id is null or whitespace, using the IUserIdService to retrieve the user id"); _userId = _userIdService.GetUserId(); } var resolution = new Dimensions((int)System.Windows.SystemParameters.PrimaryScreenWidth, (int)System.Windows.SystemParameters.PrimaryScreenHeight); var trackerManager = new TrackerManager(new PlatformInfoProvider { AnonymousClientId = UserId, UserAgent = "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko", UserLanguage = CultureInfo.CurrentUICulture.TwoLetterISOLanguageName, ScreenResolution = resolution, ViewPortResolution = resolution }); var tracker = trackerManager.GetTracker(AccountId); tracker.AppName = AppName; tracker.AppVersion = AppVersion; _tracker = tracker; Log.Info("Initialized tracker, starting to empty the existing queue now"); SendTrackingsFromQueue(); }