Created
January 10, 2019 10:08
-
-
Save justinyoo/faa17ab46a8990b2b2db02c0e77fa4d1 to your computer and use it in GitHub Desktop.
Domain Specific Language with Fluent API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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