Exemplo n.º 1
0
        /// <summary>
        /// Gets the feature that matches the provided criteria.
        /// </summary>
        /// <param name="productName">The name of the product under which the feature is positioned.</param>
        /// <param name="groupName">The name of the group under which the feature is positioned.</param>
        /// <param name="title">The title of the feature.</param>
        /// <param name="version">Version of the feature to retrieve.</param>
        /// <returns>
        /// A <see cref="DisplayableFeature"/> instance describing the requested feature;
        /// or <c>null</c> if the feature cannot be found.
        /// </returns>
        public async Task <DisplayableFeature> GetFeatureAsync(string productName, string groupName, string title, string version)
        {
            using (var session = _storeProvider.Store.OpenAsyncSession())
            {
                var dbFeature = await session.Query <Features_ByTitleProductAndGroup.QueryModel, Features_ByTitleProductAndGroup>()
                                .Where(feature => feature.Product == productName &&
                                       feature.Group == groupName &&
                                       feature.Title == title &&
                                       feature.Version == version)
                                .OfType <DbFeature>()
                                .SingleOrDefaultAsync();

                if (dbFeature == null)
                {
                    return(null);
                }

                var result = new DisplayableFeature(dbFeature);
                result.TestResult = dbFeature.TestResult;
                result.Version    = version;

                // Process the server tags
                var processor = new FeatureProcessor();
                processor.Process(result);

                return(result);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Gets the feature that matches the provided criteria.
        /// </summary>
        /// <param name="productName">The name of the product under which the feature is positioned.</param>
        /// <param name="groupName">The name of the group under which the feature is positioned.</param>
        /// <param name="title">The title of the feature.</param>
        /// <param name="version">Version of the feature to retrieve.</param>
        /// <returns>
        /// A <see cref="DisplayableFeature"/> instance describing the requested feature;
        /// or <c>null</c> if the feature cannot be found.
        /// </returns>
        public async Task <DisplayableFeature> GetFeatureAsync(string productName, string groupName, string title, string version)
        {
            using (var session = Database.DocumentStore.OpenAsyncSession())
            {
                var dbFeature = await session.LoadAsync <DbFeature>(DbFeatureExtensions.GetIdentifier(productName, groupName, title, version));

                if (dbFeature == null)
                {
                    return(null);
                }

                var result = new DisplayableFeature(dbFeature);
                result.TestResult = dbFeature.TestResult;
                result.Version    = dbFeature.Version;

                // Process the server tags
                var processor = new FeatureProcessor();
                processor.Process(result);

                return(result);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Gets the feature that matches the provided criteria.
        /// </summary>
        /// <param name="productName">The name of the product under which the feature is positioned.</param>
        /// <param name="groupName">The name of the group under which the feature is positioned.</param>
        /// <param name="title">The title of the feature.</param>
        /// <param name="version">Version of the feature to retrieve.</param>
        /// <returns>
        /// A <see cref="DisplayableFeature"/> instance describing the requested feature; 
        /// or <c>null</c> if the feature cannot be found.
        /// </returns>
        public async Task<DisplayableFeature> GetFeatureAsync(string productName, string groupName, string title, string version)
        {
            using (var session = Database.DocumentStore.OpenAsyncSession())
            {
                var dbFeature = await session.LoadAsync<DbFeature>(DbFeatureExtensions.GetIdentifier(productName, groupName, title, version));

                if (dbFeature == null)
                {
                    return null;
                }

                var result = new DisplayableFeature(dbFeature);
                result.TestResult = dbFeature.TestResult;
                result.Version = dbFeature.Version;

                // Process the server tags
                var processor = new FeatureProcessor();
                processor.Process(result);

                return result;
            }
        }