You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the table has only identity and computed columns the correct format of the insert statement is:
INSERT INTO table_name DEFAULT VALUES.
Instead, the code generated by SqlGenerator is:
INSERT INTO table_name which is incorrect.
Is there any workaround?
Thanks in advance
The text was updated successfully, but these errors were encountered:
Hi, yes. You can override the Insert function on the given repository and inject there your statement (but only if you are using this package in conjunction with Dapper.DataRepositories).
Lets say your table is called "Persons" so I'm guessing you have a "PersonsRepository". What you can do is:
public override bool Insert(Person instance) {
return this.Connection.Execute("INSERT INTO Persons DEFAULT VALUES", new {}) > 0;
}
Now, if you are not using Dapper.DataRepositories what we can do is create an attribute called "DefaultValues" or something like that to decorate your class and append the "DEFAULT VALUES" statement to the end of the generated statement.
When the table has only identity and computed columns the correct format of the insert statement is:
INSERT INTO table_name DEFAULT VALUES.
Instead, the code generated by SqlGenerator is:
INSERT INTO table_name which is incorrect.
Is there any workaround?
Thanks in advance
The text was updated successfully, but these errors were encountered: