As far as I know, it's not recommended to use AddAsync()
in every situation. based on this Microsoft documentation.
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.
And a PrimaryKey is considered as a generated value, so it means that it's possible to use an async method.
Does it mean that whenever we have a [key]
in an entity we can use AddAsync()
to add it to the database?