Both of the above do the same.
context.Add(Entity)accepts an object type, so that any type of entity that is part of the model can be transferred. This is useful if you get an object to add, but don’t know what type it will be.
context.Entities.Add(Entity)defined in DbSet, so the parameter must be of type Entityor derived type.
source
share