Exemple #1
0
        /// <summary>
        /// Gets property and value for untyped property using search conditions.
        /// Uses simple untyped search `SearchPropertyValueUntyped` if CanUseSimpleUntypedSearch or `property` has type <see cref="Search.UntypedSearch"/>.
        /// Uses full `GetPropertyValue{T}` based on property.Type in other cases.
        /// </summary>
        /// <param name="propertyContainer">Property container.</param>
        /// <param name="property">Property to search.</param>
        /// <param name="search">Search conditions.</param>
        /// <returns><see cref="IPropertyValue"/> or null.</returns>
        public static IPropertyValue?GetPropertyValueUntyped(
            this IPropertyContainer propertyContainer,
            IProperty property,
            SearchOptions?search = default)
        {
            propertyContainer.AssertArgumentNotNull(nameof(propertyContainer));
            property.AssertArgumentNotNull(nameof(property));

            if ((search ?? propertyContainer.SearchOptions).CanUseSimpleUntypedSearch() || property.Type == typeof(Search.UntypedSearch))
            {
                return(propertyContainer.SearchPropertyValueUntyped(property, search));
            }

            return(GetPropertyValueUntypedFull(propertyContainer, property, search));