public FieldsToFetch(string[] fieldsToFetch, AggregationOperation aggregationOperation, string additionalField)
{
this.additionalField = additionalField;
if (fieldsToFetch != null)
{
this.fieldsToFetch = new HashSet<string>(fieldsToFetch);
FetchAllStoredFields = this.fieldsToFetch.Remove(Constants.AllFields);
}
this.aggregationOperation = aggregationOperation.RemoveOptionals();
if (this.aggregationOperation != AggregationOperation.None)
EnsureHasField(this.aggregationOperation.ToString());
IsDistinctQuery = aggregationOperation.HasFlag(AggregationOperation.Distinct) &&
fieldsToFetch != null && fieldsToFetch.Length > 0;
IsProjection = this.fieldsToFetch != null && this.fieldsToFetch.Count > 0;
if(IsProjection && IsDistinctQuery == false)
EnsureHasField(additionalField);
}