cloudevents / sdk-csharp

CSharp SDK for CloudEvents
Apache License 2.0
278 stars 81 forks source link

Update ASP.NET Core sample to use minimal host #283

Closed captainsafia closed 6 months ago

captainsafia commented 7 months ago

This updates the ASP.NET Core sample to use some of the "modern" functionality available in .NET 6+ including top-level statements, the new minimal-style WebApplicationBuilder, and removal of the Startup class.

I've also included an .http file to support testing of the endpoint.

As a next step, I'd like to take a stab at replacing the controller class + input formatter with a minimal endpoint + BindAsync implementation, but I think this change is helpful for now.

captainsafia commented 6 months ago

Does anything use the new .http file? (It's not something I've come across before, and I'm not sure whether it's used implicitly or whether it's just as an example that has some IDE support for "send this request".) It might be worth a README file in this directory.

Rider and VS provide built-in support for executing the requests in the .http file. VS Code has an extension that you can use. I'll pop a README in the sample directory that outlines how to run the sample and execute commands against it with the CLI tool and HTTP files.

jskeet commented 6 months ago

Doh - one thing, we need each commit to have a "Signed-off-by" line.

If you could squash the two commits down to one that contains the Signed-off-by, I'll then merge. Thanks!

captainsafia commented 6 months ago

If you could squash the two commits down to one that contains the Signed-off-by, I'll then merge. Thanks!

Woop -- I ended up signing the second commit and force-pushing. If you'd prefer I squash let me know.

jskeet commented 6 months ago

If you could squash the two commits down to one that contains the Signed-off-by, I'll then merge. Thanks!

Woop -- I ended up signing the second commit and force-pushing. If you'd prefer I squash let me know.

Fingers crossed it'll be fine - I'll squash it myself as part of merging, which I think should work...

captainsafia commented 6 months ago

Build failure! Embarrassing 🙊 I'll fix this