-
Notifications
You must be signed in to change notification settings - Fork 479
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
Conversation
@@ -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() |
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.
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.
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.
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.
Thanks for the pull request. I have merged the change into the dev branch and it will go out with the next release. |
That's great. Thank you so much. |
Version 2.1.0 was just released with this pull request. Thanks for the effort! |
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.