-
Notifications
You must be signed in to change notification settings - Fork 475
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#1300 ASP.NET Core Server Custom Serializer #1311
Conversation
/// <param name="eventSource"></param> | ||
/// <param name="serializer"></param> | ||
/// <returns></returns> | ||
public static IServiceCollection AddAWSLambdaHosting(this IServiceCollection services, LambdaEventSource eventSource, ILambdaSerializer serializer) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of using a static place holder I think it would be more idiomatic to have this method that takes in an action callback that can be used for configuing.
Something like
public static IServiceCollection AddAWSLambdaHosting(this IServiceCollection services, LambdaEventSource eventSource, ILambdaSerializer serializer, Action<HostingOptions> configure = null)
{
var options = new HostingOptions();
if(configure != null) configure.Invoke(options);
...
var serializer = options.Serializer ?? new DefaultLambdaJsonSerializer();
...
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@normj code updated, I've added an integration test as well. I think I understood the integration test framework correctly and they pass on my machine. Let me know if you want any more changes.
Libraries/src/Amazon.Lambda.AspNetCoreServer/Internal/Utilities.cs
Outdated
Show resolved
Hide resolved
Libraries/src/Amazon.Lambda.AspNetCoreServer.Hosting/ServiceCollectionExtensions.cs
Outdated
Show resolved
Hide resolved
Libraries/src/Amazon.Lambda.AspNetCoreServer/Internal/HostingOptions.cs
Outdated
Show resolved
Hide resolved
I ended up doing some slight tweaks to the PR before finishing the merge. 872b510 |
PR has been released as part of version 1.5.0 of Amazon.Lambda.AspNetCoreServer.Hosting |
#1300
Allow the AspNetCoreServer.Hosting package to use a user provided serializer.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.