예제 #1
0
        public FirebaseDataStore(FirebaseAuthService authService, string path)
        {
            FirebaseOptions options = new FirebaseOptions()
            {
                AuthTokenAsyncFactory = async() => await authService.GetFirebaseAuthToken()
            };

            _query = new FirebaseClient(Config.ApiKeys.FirebaseDataBaseApi, options).Child(path);
        }
        public FirebaseOfflineDataStore(FirebaseAuthService authService, string path, string key = "")
        {
            FirebaseOptions options = new FirebaseOptions()
            {
                OfflineDatabaseFactory = (t, s) => new OfflineDatabase(t, s),
                AuthTokenAsyncFactory  = async() => await authService.GetFirebaseAuthToken()
            };

            // The offline database filename is named after type T.
            // So, if you have more than one list of type T objects, you need to differentiate it
            // by adding a filename modifier; which is what we're using the "key" parameter for.
            var client = new FirebaseClient(Config.ApiKeys.FirebaseDataBaseApi, options);

            _realtimeDb = client
                          .Child(path)
                          .AsRealtimeDatabase <T>(key, "", StreamingOptions.LatestOnly, InitialPullStrategy.MissingOnly, true);
        }