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

Adds More Convenient Typed Startup for ASP.NET Core #308

Merged
merged 2 commits into from
Sep 25, 2018
Merged

Adds More Convenient Typed Startup for ASP.NET Core #308

merged 2 commits into from
Sep 25, 2018

Conversation

chrisoverzero
Copy link
Contributor

Description of changes:

Adds an inheritor of APIGatewayProxyFunction that allows specifying the application's startup type as a type parameter.

This largely mirrors the method static IWebHostBuilder CreateDefaultBuilder<TStartup>(string[]) where TStartup : class provided by ASP.NET Core, and is nice to have for the same reasons as that method is nice to have.

also corrects the name of the class in a comment

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@@ -5,16 +5,15 @@

namespace TestWebApp
{
public class LambdaFunction : APIGatewayProxyFunction
public class LambdaFunction : APIGatewayProxyFunction<Startup>
{
public const string BinaryContentType = "application/octet-stream";

protected override void Init(IWebHostBuilder builder)
{
builder
.UseApiGateway()
Copy link
Contributor Author

@chrisoverzero chrisoverzero Aug 30, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both of these remaining "Use-" methods are already called in CreateWebHostBuilder, but it would look odd to have Init simply return the builder, I thought, so I left it alone. Unless Init became virtual instead of abstract in the TStartup variant? Way out of scope, I understand.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The more I think about it, the more it makes sense. An IWebHostBuilder created by the typed variant doesn't require any other setup. I think it should be overridden to provide a default implementation of Init.

Because an `IWebHostBuilder` can exit `CreateWebHostBuilder` in a
usable state, `Init` may not be necessary to override in a client's
entry point.
@normj
Copy link
Member

normj commented Sep 14, 2018

Thanks for the pull request. I have merged the change into the dev branch and it will go out with the next release.

@chrisoverzero
Copy link
Contributor Author

That's great. Thank you so much.

@normj normj merged commit 5f8f060 into aws:master Sep 25, 2018
@normj
Copy link
Member

normj commented Sep 25, 2018

Version 2.1.0 was just released with this pull request. Thanks for the effort!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants