コード例 #1
0
        public HttpResponseMessage ConfigNamesStartingWith(string prefix)
        {
            if (prefix == null)
            {
                prefix = "";
            }
            ConfigurationSearchResults results = null;

            Storage.Batch(accessor =>
            {
                int totalResults;
                var names = accessor.GetConfigNamesStartingWithPrefix(prefix, Paging.Start, Paging.PageSize,
                                                                      out totalResults);

                results = new ConfigurationSearchResults
                {
                    ConfigNames = names,
                    PageSize    = Paging.PageSize,
                    Start       = Paging.Start,
                    TotalCount  = totalResults
                };
            });

            return(this.GetMessageWithObject(results)
                   .WithNoCache());
        }
コード例 #2
0
        public async Task Foo()
        {
            IFilesStore store = null;

            #region set_key_3
            await store
            .AsyncFilesCommands
            .Configuration
            .SetKeyAsync("descriptions/intro.avi", new FileDescription { /* ... */ });

            #endregion

            #region get_key_2

            FileDescription desc = await store
                                   .AsyncFilesCommands
                                   .Configuration
                                   .GetKeyAsync <FileDescription>("descriptions/intro.avi");

            #endregion

            #region delete_key_2

            await store
            .AsyncFilesCommands
            .Configuration
            .DeleteKeyAsync("descriptions/intro.avi");

            #endregion

            {
                #region get_key_names_2

                string[] names = await store
                                 .AsyncFilesCommands
                                 .Configuration
                                 .GetKeyNamesAsync();

                #endregion
            }

            {
                #region search_2

                int start    = 0;
                int pageSize = 10;

                do
                {
                    ConfigurationSearchResults results = await store
                                                         .AsyncFilesCommands
                                                         .Configuration
                                                         .SearchAsync("descriptions/", start, pageSize);

                    IList <string> names = results.ConfigNames;

                    start += pageSize;

                    if (names.Count < pageSize)
                    {
                        break;
                    }
                } while (true);
                #endregion
            }
        }