コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CompartmentSearchExpression"/> class.
        /// </summary>
        /// <param name="compartmentType">The compartment type.</param>
        /// <param name="compartmentId">The compartment id.</param>
        public CompartmentSearchExpression(string compartmentType, string compartmentId)
        {
            EnsureArg.IsTrue(ModelInfoProvider.IsKnownCompartmentType(compartmentType), nameof(compartmentType));
            EnsureArg.IsNotNullOrWhiteSpace(compartmentId, nameof(compartmentId));

            CompartmentType = compartmentType;
            CompartmentId   = compartmentId;
        }
コード例 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CompartmentSearchExpression"/> class.
        /// </summary>
        /// <param name="compartmentType">The compartment type.</param>
        /// <param name="compartmentId">The compartment id.</param>
        /// <param name="filteredResourceTypes">Resource types to filter</param>
        public CompartmentSearchExpression(string compartmentType, string compartmentId, params string[] filteredResourceTypes)
        {
            EnsureArg.IsTrue(ModelInfoProvider.IsKnownCompartmentType(compartmentType), nameof(compartmentType));
            EnsureArg.IsNotNullOrWhiteSpace(compartmentId, nameof(compartmentId));

            CompartmentType       = compartmentType;
            CompartmentId         = compartmentId;
            FilteredResourceTypes = filteredResourceTypes ?? Array.Empty <string>();
        }
コード例 #3
0
        public bool Match(HttpContext httpContext, IRouter route, string routeKey, RouteValueDictionary values, RouteDirection routeDirection)
        {
            EnsureArg.IsNotNull(httpContext, nameof(httpContext));
            EnsureArg.IsNotNull(route, nameof(route));
            EnsureArg.IsNotNullOrEmpty(routeKey, nameof(routeKey));
            EnsureArg.IsNotNull(values, nameof(values));

            if (values.TryGetValue(KnownActionParameterNames.CompartmentType, out var compartmentTypeObj) &&
                compartmentTypeObj is string compartmentType &&
                !string.IsNullOrEmpty(compartmentType))
            {
                return(ModelInfoProvider.IsKnownCompartmentType(compartmentType));
            }

            return(false);
        }