Skip to content

What's new in .NET 7 preview /2#26230

Merged
Rick-Anderson merged 11 commits into
mainfrom
whatsNew7/2
Jul 1, 2022
Merged

What's new in .NET 7 preview /2#26230
Rick-Anderson merged 11 commits into
mainfrom
whatsNew7/2

Conversation

@Rick-Anderson
Copy link
Copy Markdown
Contributor

@Rick-Anderson Rick-Anderson commented Jun 25, 2022

@Rick-Anderson Rick-Anderson marked this pull request as ready for review June 28, 2022 00:23
Comment on lines +36 to +50
#elif MIN
// The following code works in .NET 6, not new to .NET 7
#region snippet_min
using Microsoft.AspNetCore.Mvc;

var builder = WebApplication.CreateBuilder(args);
builder.Services.AddSingleton<IDateTime, SystemDateTime>();

var app = builder.Build();

app.MapGet("/", ( IDateTime dateTime) => dateTime.Now);
app.MapGet("/fs", ([FromServices] IDateTime dateTime) => dateTime.Now);
app.Run();
#endregion
#endif
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Should I mention in .NET 6, minimal APIs don't require [FromServices]?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@Rick-Anderson I don't see where this snippet is used in the docs. Are you planning to add something related to that? If not, I am not sure if it is needed

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@Rick-Anderson I don't see where this snippet is used in the docs. Are you planning to add something related to that? If not, I am not sure if it is needed

It's not in the doc. I'll remove it. I was wondering if I should say "Minimal APIs in .NET 6 did not require [FromServices]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In my opinion, we don't need to mention anything here since it is a doc with the new features.

@brunolins16 brunolins16 requested a review from a team June 30, 2022 22:16
Comment thread aspnetcore/release-notes/aspnetcore-7.0.md
Comment thread aspnetcore/release-notes/aspnetcore-7.0.md Outdated

[!code-csharp[](~/release-notes/aspnetcore-7/samples/ApiController/Program.cs?name=snippet_dis&highlight=8-11)]

Prior to ASP.NET Core 7, one of the following approaches was required to bind a source in API Controller action:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I am not sure if we need this paragraph here. It is a little bit confusing

Copy link
Copy Markdown
Member

@brunolins16 brunolins16 left a comment

Choose a reason for hiding this comment

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

The initial API Controller features doc looks good for me (only small nits). It will be awesome when we have all the features together 👏.

Comment thread aspnetcore/release-notes/aspnetcore-7.0.md
@Rick-Anderson Rick-Anderson merged commit 40e519e into main Jul 1, 2022
@Rick-Anderson Rick-Anderson deleted the whatsNew7/2 branch July 1, 2022 21:56
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.

.NET 7: Create "What's new in 7.0 previews"

2 participants