Skip to content

Instantly share code, notes, and snippets.

@justinyoo
Created January 10, 2019 10:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justinyoo/faa17ab46a8990b2b2db02c0e77fa4d1 to your computer and use it in GitHub Desktop.
Save justinyoo/faa17ab46a8990b2b2db02c0e77fa4d1 to your computer and use it in GitHub Desktop.
Domain Specific Language with Fluent API
public static IFunctionFactory Factory { get; set; } = new FunctionFactory(new AppModule());
[FunctionName(nameof(XmlToXmlMapperHttpTrigger))]
public static async Task<HttpResponseMessage> Run(
[HttpTrigger(AuthorizationLevel.Function, "post", Route = "mappers/xml/xml")] HttpRequestMessage req,
ILogger log)
{
return result = await Factory.Create<IXmlToXmlMapperFunction, ILogger>(log)
.InvokeAsync<HttpRequestMessage, HttpResponseMessage>(req)
.ConfigureAwait(false);
}
public static async Task<IXmlTransformHelper> AddArgumentsAsync(this Task<IXmlTransformHelper> helper, List<ExtensionObject> eos)
{
var instance = await helper.ConfigureAwait(false);
return await instance.AddArgumentsAsync(eos).ConfigureAwait(false);
}
var content = await this._helper
.LoadXslAsync(this._settings.Containers.Mappers, request.Mapper.Directory, request.Mapper.Name)
.AddArgumentsAsync(request.ExtensionObjects)
.TransformAsync(request.InputXml);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment