BO4E/meta/Bo4eUri.cs
/// <summary>
///     returns a new Bo4eUri instance with an additional filter in the query
/// </summary>
/// <param name="filterObject"></param>
returns a new Bo4eUri instance with an additional filter in the query
returns a new Bo4eUri instance with an additional filter in the query
public Bo4eUri AddFilter(IDictionary<string, object> filterObject)
        {
            var query = HttpUtility.ParseQueryString(Query);
            var filterString = string.Empty;
            var boFields = GetBoType().GetProperties().Select(p => p.Name);
            const string andString = " and ";
            filterString = filterObject
                .Where(kvp => kvp.Value != null && boFields.Contains(kvp.Key, StringComparer.OrdinalIgnoreCase))
                .Aggregate(filterString, (current, kvp) => current + $"{andString}{kvp.Key} eq '{kvp.Value}'");
            if (filterString.StartsWith(andString)) filterString = filterString.Substring(andString.Length);
            query.Add("filter", filterString);
            var ub = new UriBuilder(this)
            {
                Query = query.ToString()
            };
            return new Bo4eUri(ub.Uri.ToString());
        }
public Bo4eUri AddFilter ( IDictionary < string , object > filterObject ) { var query = HttpUtility . ParseQueryString ( Query ) ; var filterString = string . Empty ; var boFields = GetBoType ( ) . GetProperties ( ) . Select ( p => p . Name ) ; const string andString = " " ; filterString = filterObject . Where ( kvp => kvp . Value != null && boFields . Contains ( kvp . Key , StringComparer . OrdinalIgnoreCase ) ) . Aggregate ( filterString , ( current , kvp ) => current + $" { andString } { kvp . Key }  eq ' { kvp . Value } ' " ) ; if ( filterString . StartsWith ( andString ) ) filterString = filterString . Substring ( andString . Length ) ; query . Add ( " " , filterString ) ; var ub = new UriBuilder ( this ) { Query = query . ToString ( ) } ; return new Bo4eUri ( ub . Uri . ToString ( ) ) ; }
returns a new Bo4eUri instance with an additional filter in the query
returns a new Bo4eUri instance with an additional filter in the query
filterObject
IDictionary<string, object>
None