SonarSource/sonar-dotnet

Fix S6966 Awaitable method should be used

Closed this issue · 1 comments

Description

https://rules.sonarsource.com/csharp/RSPEC-6966/

According to their documentation
https://learn.microsoft.com/en-us/dotnet/api/microsoft.entityframeworkcore.dbcontext.addasync?view=efcore-8.0

This method is async only to allow special value generators, such as the one used by 'Microsoft.EntityFrameworkCore.Metadata.SqlServerValueGenerationStrategy.SequenceHiLo', to access the database asynchronously. For all other cases the **non async method should be used**.

Repro steps

Any DbSet.Add from entityframework core

Expected behavior

Shoudn't force to use AddAsync or AddRangeAsync

Actual behavior

force to use async version

Hello @knopa - this FP has already been fixed in #9269. The fix will come with the next release.