check the below images





The id column is an identity column but i keep getting the above error, i tried both ways assigning a value for Id and not assigning a value for the Id but still it doesn't work any thoughts? or am i missing something.
@mgravell
@ishamfazal how is StockReference defined exactly in the database? Does StockReference.Id have an Identity Specification?
@joncloud Thanks for your reply. i fixed the error
For posterity, the issue (for me anyway) was that I had specified [Key], instead of [ExplicitKey]. I had a one-to-one relationship table.
Thanks to joncloud for pointing me in the right direction.
Also for posterity, I had the same message when I had decorated my poco class id property with System.ComponentModel.DataAnnotations.KeyAttribute instead of Dapper.Contrib.Extensions.KeyAttribute. if you don't fully qualify the attribute this is very easy to miss.
Most helpful comment
For posterity, the issue (for me anyway) was that I had specified
[Key], instead of[ExplicitKey]. I had a one-to-one relationship table.Thanks to joncloud for pointing me in the right direction.