public UserDataSource(ISingleObjectStorage <IDatabaseUser> storage, ITimeService timeService) : base(storage, null) { Ensure.Argument.IsNotNull(timeService, nameof(timeService)); this.timeService = timeService; }
public UserDataSource(ISingleObjectStorage <IDatabaseUser> storage, IUserApi userApi) { Ensure.Argument.IsNotNull(storage, nameof(storage)); Ensure.Argument.IsNotNull(userApi, nameof(userApi)); this.storage = storage; this.userApi = userApi; }
public PreferencesDataSource(ISingleObjectStorage <IDatabasePreferences> storage) { Ensure.Argument.IsNotNull(storage, nameof(storage)); this.storage = storage; currentPreferencesSubject = new ReplaySubject <IDatabasePreferences>(1); Current = currentPreferencesSubject.AsObservable(); Get().Do(currentPreferencesSubject.OnNext); }
public PreferencesDataSource(ISingleObjectStorage <IDatabasePreferences> storage) { Ensure.Argument.IsNotNull(storage, nameof(storage)); this.storage = storage; currentPreferencesSubject = new BehaviorSubject <IDatabasePreferences>(Preferences.DefaultPreferences); Current = currentPreferencesSubject.AsObservable(); // right after login/signup the database does not contain the preferences and retreiving // it will fail we can ignore this error because it will be immediately fetched and until // then the default preferences will be used initializationDisposable = Get().Subscribe(currentPreferencesSubject.OnNext, (Exception _) => { }); }
protected SingletonDataSource(ISingleObjectStorage <TDatabase> storage, TThreadsafe defaultCurrentValue) : base(storage) { Ensure.Argument.IsNotNull(storage, nameof(storage)); this.storage = storage; currentSubject = new Subject <TThreadsafe>(); var initialValueObservable = storage.Single() .Select(Convert) .Catch((Exception _) => Observable.Return(defaultCurrentValue)) .FirstAsync(); var connectableCurrent = initialValueObservable.Concat(currentSubject).Replay(1); connectableCurrent.Connect(); Current = connectableCurrent; }
public PreferencesDataSource(ISingleObjectStorage <IDatabasePreferences> storage) : base(storage, Preferences.DefaultPreferences) { }
public UserDataSource(ISingleObjectStorage <IDatabaseUser> storage) : base(storage, null) { }
public TestSingletonSource(ISingleObjectStorage <IDatabaseTestModel> storage, IThreadSafeTestModel defaultCurrentValue) : base(storage, defaultCurrentValue) { }
public UserDataSource(ISingleObjectStorage <IDatabaseUser> storage) { Ensure.Argument.IsNotNull(storage, nameof(storage)); this.storage = storage; }