/// <summary> /// Writes "actions" or "functions" metadata. /// </summary> /// <param name="operations">The operations to write.</param> /// <param name="isAction">true when writing the entry's actions; false when writing the entry's functions.</param> internal void WriteOperations(IEnumerable <ODataOperation> operations, bool isAction) { // We cannot compare two URI's directly because the 'Equals' method on the 'Uri' class compares two 'Uri' instances without regard to the // fragment part of the URI. (E.G: For 'http://someuri/index.htm#EC.action1' and http://someuri/index.htm#EC.action2', the 'Equals' method // will return true. IEnumerable <IGrouping <string, ODataOperation> > metadataGroups = operations.GroupBy(o => { // We need to validate here to ensure that the metadata is not null, otherwise call to the method 'UriToString' will throw. ValidationUtils.ValidateOperationNotNull(o, isAction); WriterValidationUtils.ValidateCanWriteOperation(o, this.JsonLightOutputContext.WritingResponse); ODataJsonLightValidationUtils.ValidateOperation(this.MetadataDocumentBaseUri, o); return(this.GetOperationMetadataString(o)); }); foreach (IGrouping <string, ODataOperation> metadataGroup in metadataGroups) { this.WriteOperationMetadataGroup(metadataGroup); } }