-
Notifications
You must be signed in to change notification settings - Fork 13
Description
I have read the wiki and it says-"[PrimaryKey] - mark the property used as the primary key, which must be an int?, long?, or GUID? with this attribute."
Does it mean "int" (non-nullable int) is not allowed as Primary key?
When I run my code (that uses SimpleSave nuget package) and with non-nullable int as primary key, I do get an exception which says that int as primary key is not allowed.
Looked around further in wiki for more information as to why "int" would not be allowed as primary key, I did not find anything. Not satisfied, I ventured into the source code and I found conflicting checks for primary key type in a couple of files (first one does not allow int, while the second one does):
\Dapper.SimpleSave-master\src\Dapper.SimpleSave\Impl\ DtoMetadataValidator.cs

\Dapper.SimpleSave-master\src\Dapper.SimpleSave\Impl\ ScriptBuilder.cs

Moreover, when I change the check in my local copy of SimpleSave source code to allow "non-nullable int", and run my model (with non-nullable int as primary key) against it, I am able to save my model into database fine.
So, is non-nullable int really not allowed as Primary key, or is it just a bug that needs fixed?
Thanks.