/// <summary> /// Gets the metadata set from the Resource Management Service /// </summary> /// <returns></returns> private static MetadataSet GetMetadataSet(EndpointManager e) { MetadataSet set; GetMetadata body = new GetMetadata(); body.Dialect = Namespaces.XmlSchema; body.Identifier = string.Format("xs:schema/{0}", Namespaces.ResourceManagement); Message requestMessage = Message.CreateMessage(MessageVersion.Default, Namespaces.Get, new SerializerBodyWriter(body)); Binding httpBinding = BindingManager.GetWsHttpBinding(); ResourceManagementService.MetadataExchangeClient mex = new ResourceManagementService.MetadataExchangeClient(httpBinding, e.MetadataEndpoint); Message responseMessage = mex.Get(requestMessage); if (responseMessage.IsFault) { // We shouldn't get here as the WCF framework should convert the fault into an exception MessageFault fault = MessageFault.CreateFault(responseMessage, Int32.MaxValue); throw new FaultException(fault); } set = responseMessage.GetBody <MetadataSet>(); return(set); }
static async Task Main(string[] args) { var request = new DefaultHttpContext().Request; request.Method = HttpMethods.Post; request.Body = new MemoryStream(Encoding.ASCII.GetBytes("{\"storageAccount\":\"myStorageAccount\",\"container\":\"myContainer\",\"folderPath\":\"Path/To/Root\"}")); var response = await GetMetadata.Run(request, null); var okResponse = (OkObjectResult)response; Console.WriteLine(okResponse.Value.ToString()); }
public async Task <DataView> View(GetMetadata request) { return(await _mediator.Send(request)); }