/// <summary>
        /// Converts the raw value from an Umbraco property into a format that can be indexed by Examine.
        /// </summary>
        /// <param name="attribute">
        /// The <see cref="SearchResolverAttribute"/> containing additional information  indicating how to resolve the property.
        /// </param>
        /// <param name="content">The <see cref="IPublishedContent"/>to resolve the value for.</param>
        /// <param name="property">The <see cref="PropertyInfo"/> to resolve the value for.</param>
        /// <param name="rawValue">The raw property value from Umbraco.</param>
        /// <param name="culture"> The <see cref="CultureInfo"/> to help parse values with the correct culture.</param>
        /// <returns>
        /// The <see cref="string"/>.
        /// </returns>
        internal virtual string ResolveValue(SearchResolverAttribute attribute, IPublishedContent content, PropertyInfo property, string rawValue, CultureInfo culture)
        {
            this.Attribute = attribute;
            this.Content   = content;
            this.RawValue  = rawValue;
            this.Culture   = culture;

            return(this.ResolveValue());
        }
Example #2
0
        /// <summary>
        /// Converts the raw value from an Umbraco property into a format that can be indexed by Examine.
        /// </summary>
        /// <param name="attribute">
        /// The <see cref="SearchResolverAttribute"/> containing additional information  indicating how to resolve the property.
        /// </param>
        /// <param name="content">The <see cref="IPublishedContent"/>to resolve the value for.</param>
        /// <param name="property">The <see cref="PropertyInfo"/> to resolve the value for.</param>
        /// <param name="rawValue">The raw property value from Umbraco.</param>
        /// <param name="culture"> The <see cref="CultureInfo"/> to help parse values with the correct culture.</param>
        /// <returns>
        /// The <see cref="string"/>.
        /// </returns>
        internal override string ResolveValue(SearchResolverAttribute attribute, IPublishedContent content, PropertyInfo property, string rawValue, CultureInfo culture)
        {
            if (!(attribute is TAttributeType))
            {
                throw new ArgumentException(
                          "The resolver attribute must be of type " + typeof(TAttributeType).AssemblyQualifiedName,
                          nameof(attribute));
            }

            this.Attribute = (TAttributeType)attribute;
            this.Content   = content;
            this.Property  = property;
            this.RawValue  = rawValue;
            this.Culture   = culture;

            return(this.ResolveValue());
        }
        /// <summary>
        /// Determines whether the specified <see cref="object" />, is equal to this instance.
        /// </summary>
        /// <param name="obj">The <see cref="object" /> to compare with this instance.</param>
        /// <returns>
        ///   <c>true</c> if the specified <see cref="object" /> is equal to this instance; otherwise, <c>false</c>.
        /// </returns>
        public override bool Equals(object obj)
        {
            SearchResolverAttribute other = obj as SearchResolverAttribute;

            return((other != null) && other.ResolverType.AssemblyQualifiedName == this.resolverType.AssemblyQualifiedName);
        }