Open alexpantyukhin opened 2 years ago
First, I found that the primary key cannot be inserted. The primary key does not support insertion (it must rely on mysql to automatically process the value. If it is not set, an exception will be thrown if the default value is not set).
Second, there seems to be some problems with data types. MySQL defines the column as int, but C # prompts that I cannot convert the exception of type int64 to int32.
I hope I can get your fix, much appreciated.
@kelilife For example: the primary key could be a composite key (2 or more fields), which consists from foreign keys on other tables.
@alexpantyukhin I am now using another ORM framework and basically have no problems. It seems that the primary key is affected to the detriment of inserting data into it, even if it is the primary key for only one field. As for the rest I don't know much about it.
Hello! Thank you for the great lib! I have an issue with
Insert
function. I have anEntity
with 2 not null primary keys:So there is the composite key for OtherEntityId and OtherEntityField.
When I try to put it into the DB:
I got an error: Cannot insert the value NULL into column 'OtherEntityId', table 'DB.dbo.TicketField'; column does not allow nulls. INSERT fails.
I think that it's because of these lines of code: https://github.com/tmsmith/Dapper-Extensions/blob/master/DapperExtensions/Sql/SqlGenerator.cs#L228 . It skips the primary keys values. It would be good if the lib checks if fields of the DB set up
not null
value and allow to put values into theinsert
command.