What is the purpose of Dapper's [ExplicitKey] attribute? In this example generated SQL is absolutely identical, regardless of whether the key is applied or not.
exec sp_executesql N'insert into InvoiceDetail ([InvoiceID], [Detail]) values (@InvoiceID, @Detail); select SCOPE_IDENTITY() id',N'@Detail nvarchar(4000),@InvoiceID int',@Detail=N'Insert_Single_1',@InvoiceID=4
This is why the attribute exists:
The [Key] attribute assumes an autoincremented key, and when you try to pass a custom (e.g. non-int) key instead, Insert and InsertAsync fail with NullReferenceException, even if the passed value clearly isn't null. So [ExplicitKey] was introduced to handle those instead.