/// <summary>
        /// Initializes the partition resolver to be used with Item repository.
        /// </summary>
        /// <param name="resolverService"></param>
        public async void getResolver(int resolverService)
        {
            switch (resolverService)
            {
            case Hash:
                HashPartitionResolver hashResolver = await PartitionInitializers.InitializeHashResolver("tenantId", Client, Database, collections);

                break;

            case ManagedHash:
                ManagedHashPartitionResolver managedHashResolver = PartitionInitializers.InitializeManagedHashResolver(i => ((Item)i).tenantId, Client, Database, 3, null);
                break;

            case Spillover:
                SpilloverPartitionResolver spilloverResolver = new SpilloverPartitionResolver(Client, Database);
                Client.PartitionResolvers[Database.SelfLink] = spilloverResolver;
                break;

            case Range:
                RangePartitionResolver <string> rangeResolver = await PartitionInitializers.InitializeRangeResolver("tenantId", Client, Database, collections);

                break;

            case Lookup:
                LookupPartitionResolver <string> lookupResolver = await PartitionInitializers.InitializeLookupPartitionResolver("tenantId", Client, Database, collections);

                break;

            default:
                goto case Hash;
            }
        }
        public async Task <IHttpActionResult> HashPartitionResolver()
        {
            string[] collections = AppSettingsConfig.MainCollection.Split(',');
            var      database    = await DocumentClientHelper.GetNewDatabaseAsync(_client, AppSettingsConfig.Db);

            HashPartitionResolver hashResolver = await PartitionInitializers.InitializeHashResolver("UserId", _client, database, collections);

            return(Ok());
        }
예제 #3
0
        /// <summary>
        /// Initializes the partition resolver to be used with Item repository.
        /// </summary>
        /// <param name="resolverService"></param>
        public async void getResolver(int resolverService)
        {
            switch (resolverService)
            {
            case Hash:
                HashPartitionResolver hashResolver = await PartitionInitializers.InitializeHashResolver("docType", Client, Database, collections);

                break;

            case ManagedHash:
                ManagedHashPartitionResolver managedHashResolver = PartitionInitializers.InitializeManagedHashResolver(i => ((ItemBase)i).docType, Client, Database, 3, null);
                break;

            default:
                goto case Hash;
            }
        }