I was implementing fluent validation in .NET 8 application and got warning that AddFluentValidation is obsolete.
Solution
to overcome this instead of below
builder.Services.AddValidatorsFromAssemblyContaining<FlightBookingRequestValidator>();
We have to use the below line of code in the Program.cs file to implement fluent validation in .NET 8 application.
builder.Services.AddFluentValidationAutoValidation()
.AddFluentValidationClientsideAdapters();
builder.Services.AddValidatorsFromAssemblyContaining<UserprofileValidator>();
We need to replace AddValidatorsFromAssemblyContaining with
.AddFluentValidationAutoValidation()
.AddFluentValidationClientsideAdapters();