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

Update where a property is set to null isn't translated correctly. #246

Open
lievencardoen opened this issue Dec 22, 2010 · 0 comments
Open

Comments

@lievencardoen
Copy link
Contributor

Next Update crashes because the x => x.Name == null will be translated to a Comparison.Is. As a consequence, in Update.cs, a InvalidOperationException is thrown saying 'Can't use a non-equality here'.

In the Where part, this would be correct but in the Set part it should be translated to a Comparison.Equals.

var affectedRecords = Db.Update<Schedule>()
.Set(x => x.Name == null, 
x => x.Description == entity.description)
.Where(x => x.ScheduleId == entity.id && x.Version == entity.version)
.Execute();

I solved this by adding a line in the Set method in Update.cs before the check on equality comparison.

if (c.Comparison == Comparison.Is) c.Comparison = Comparison.Equals;
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