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

Varchar primary key not correctly quoted #240

Open
arntj-bouvet opened this issue May 24, 2024 · 0 comments
Open

Varchar primary key not correctly quoted #240

arntj-bouvet opened this issue May 24, 2024 · 0 comments

Comments

@arntj-bouvet
Copy link

Hello,

we are currently working on a project using Trackable Entities for EF v6. We are currently using 2.5.7 (newest version).

In this project, we have two tables that are related to each other. The Main table has a foreign key to a type table.

The type table has a primary key of 2 columns.
Column 1 is smallint
Columns 2 is nvarchar(5)

We used Trackable Entities to track this relation. When running LoadRelatedEntities in EF6, we encountered the following exception:
bilde

('TRAKT' is a value, not a column name!)

We stepped through the code in VS, and stepped inside Trackable Entities code. What we found is as follows:
bilde

The key that is NVARCHAR isn't surrounded with single quotation marks.

Then, inside GetWhereSql, it is inserted without quotation marks:
bilde

The where clause we end up with is then:
bilde
WHERE (x.FirmaID = 10 AND x.KjoretoyType = TRAKT)

when it should be:
WHERE (x.FirmaID = 10 AND x.KjoretoyType = 'TRAKT')

This leads to an exception as the SQL isn't correctly shaped.

Again, this happens when the newest version (2.5.7) is installed with Nuget.

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

No branches or pull requests

1 participant