예제 #1
0
        private DataStore(DataStoreType type, string collectionName, AbstractClient client = null)
            : base(new KinveyQueryProvider(typeof(KinveyQueryable <T>), QueryParser.CreateDefault(), new KinveyQueryExecutor <T>()), typeof(T))
        {
            this.collectionName = collectionName;

            if (client != null)
            {
                this.client = client;
            }
            else
            {
                this.client = Client.SharedClient;
            }

            if (type != DataStoreType.NETWORK)
            {
                this.cache     = this.client.CacheManager.GetCache <T>(collectionName);
                this.syncQueue = this.client.CacheManager.GetSyncQueue(collectionName);
            }

            this.storeType = type;
            this.customRequestProperties = this.client.GetCustomRequestProperties();
            this.networkFactory          = new NetworkFactory(this.client);
            this.DeltaSetFetchingEnabled = false;
            this.AutoPagination          = false;
        }
예제 #2
0
 /// <summary>
 /// Gets an instance of the <see cref="KinveyXamarin.DataStore{T}"/>.
 /// </summary>
 /// <returns>The DataStore instance.</returns>
 /// <param name="type">The <see cref="KinveyXamarin.DataStoreType"/> of this DataStore instance</param>
 /// <param name="collectionName">Collection name of the Kinvey collection backing this DataStore</param>
 /// <param name="client">Kinvey Client used by this DataStore (optional). If the client is not specified, the <see cref="KinveyXamarin.Client.SharedClient"/> is used.</param>
 public static DataStore <T> Collection(string collectionName, DataStoreType type, AbstractClient client = null)
 {
     // TODO do we need to make this a singleton based on collection, store type and store ID?
     return(new DataStore <T> (type, collectionName, client));
 }