/// <summary> /// Constructs this facet query componnent with the given <paramref name="facet"/>. /// </summary> /// <param name="facet">The <see cref="Facet"/>.</param> public FacetQueryComponent(FacetDefinition facet) { // validate arguments if (facet == null) throw new ArgumentNullException("facet"); // set values this.facet = facet; }
/// <summary> /// Copies the given <paramref name="facet"/>/ /// </summary> /// <param name="facet">The <see cref="Facet"/> which to copy.</param> protected Facet(FacetDefinition facet) { // validate arguments if (facet == null) throw new ArgumentNullException("facet"); // set values friendlyName = facet.FriendlyName; propertyName = facet.PropertyName; }
/// <summary> /// Construcs a <see cref="FacetResult"/> from the given <paramref name="definition"/> and <paramref name="values"/>. /// </summary> /// <param name="context">The <see cref="IMansionContext"/>.</param> /// <param name="definition">The <see cref="FacetDefinition"/>.</param> /// <param name="values">The <see cref="FacetValue"/>s.</param> /// <returns>Returns the created <see cref="FacetResult"/>.</returns> /// <exception cref="ArgumentNullException">Thrown if one of the parameters is null.</exception> public static FacetResult Create(IMansionContext context, FacetDefinition definition, IEnumerable<FacetValue> values) { // validate arguments if (context == null) throw new ArgumentNullException("context"); if (definition == null) throw new ArgumentNullException("definition"); if (values == null) throw new ArgumentNullException("values"); // transform the result using the definition var transformedResults = definition.Transform(context, values); // create the facet result return new FacetResult(definition.PropertyName, definition.FriendlyName, transformedResults); }