We might run into performance issue while trying to perform bulk insertion that might be importing data from other sources or migrating content from another blogging system. In those scenarios, if we have AutoDetectChangesEnabled, then we might run into performance issues since EF Core's ObjectStateManager.DetectChanges() performs too costly operations on each insert operation.
For illustration, we could handle the bulk insert/update detect changes partly in our CreatePost code, which will perform a bulk tag insertion. We could handle this issue by disabling AutoDetectChangesEnabled just before adding the entities and enabling them back before calling SaveChanges(). The following little highlighted change would provide a huge performance improvement against the execution time:
public class CreatePostCommand : CommandBase,
ICreatePostCommand...