40
loading...
This website collects cookies to deliver better user experience
[EditorRequired]
attribute, like this:[EditorRequired]
[Parameter]
public string Title { get; set; }
DangerousEnableCompression
. No, seriously.builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new OpenApiInfo { Title = "My API", Description = "My Swagger", Version = "v1" });
});
[FromServices]
attribute. Previously, you needed to do something like this:app.MapGet("/movies", async ([FromServices] MovieDbContext db) =>
{
return await db.Movies.ToListAsync();
});
app.MapGet("/movies", async (MovieDbContext db) =>
{
return await db.Movies.ToListAsync();
});
ConfigureConventions
override to avoid the hassle of configuring every entity. In Jeremy's example, if you want to always store strings as byte arrays, you can use the override instead:protected override void ConfigureConventions(ModelConfigurationBuilder configurationBuilder)
{
configurationBuilder.Properties<string>()
.HaveConversion<byte[]>()
.HaveMaxLength(255);
configurationBuilder.IgnoreAny<INonPersisted>();
}
maui
, maui-mobile
, and maui-desktop
workloads, and soon Visual Studio 2022 will include these workloads in the installer.