Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GetAsync fails on SQL Server when the primary key property is a reserved SQL keyword #150

Open
ghills opened this issue Dec 5, 2022 · 0 comments · May be fixed by #149
Open

GetAsync fails on SQL Server when the primary key property is a reserved SQL keyword #150

ghills opened this issue Dec 5, 2022 · 0 comments · May be fixed by #149

Comments

@ghills
Copy link

ghills commented Dec 5, 2022

sql = $"SELECT * FROM {name} WHERE {key.Name} = @id";

The query building for Get/GetAsync do simple string formatting to include the property name for the primary key of the table instead of formatting the escaped column name.

For example, a property named Key with the ExplicitKeyAttribute should work but fails because KEY is a reserved SQL keyword. The column name should be included as WHERE [Key] = @id instead.

@ghills ghills linked a pull request Dec 5, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant