Skip to content
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

Merged
merged 10 commits into from
Dec 9, 2022
Merged

#1300 ASP.NET Core Server Custom Serializer #1311

merged 10 commits into from
Dec 9, 2022

Conversation

jeastham1993
Copy link
Contributor

#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.

@ashishdhingra ashishdhingra added the feature-request A feature should be added or improved. label Oct 11, 2022
/// <param name="eventSource"></param>
/// <param name="serializer"></param>
/// <returns></returns>
public static IServiceCollection AddAWSLambdaHosting(this IServiceCollection services, LambdaEventSource eventSource, ILambdaSerializer serializer)
Copy link
Member

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();

   ...
}

Copy link
Contributor Author

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.

@normj normj merged commit e39b7b3 into aws:master Dec 9, 2022
@normj
Copy link
Member

normj commented Dec 9, 2022

I ended up doing some slight tweaks to the PR before finishing the merge. 872b510

@normj
Copy link
Member

normj commented Dec 9, 2022

PR has been released as part of version 1.5.0 of Amazon.Lambda.AspNetCoreServer.Hosting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A feature should be added or improved.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants