ServiceStack ORMLite UpdateOnly glitch

Viewed 493

I have an object User with a property LastLoggedIn, following is the code I write to update this field:

using (var o = Conn.OpenDbConnection()) {
    var onlyFields = (x => x.LastLoggedIn); 
    var where = (x => x.Id == item.Id); 
    return o.UpdateOnly(item, onlyFields, where);
}

I use SQL Server Profiler to capture the output statement, and I got:

UPDATE "Users" SET "LastLoggedIn" = '20131228 11:39:31.441' WHERE ("Id" = "Id")

(Screenshot of Debug + SQL Profiler)

enter image description here

Notice SQL Profiler says "Id" = "Id"? It really should be "Id" = "iNa7EKWjKkKMu...". What have I done wrong? Thanks for your help.

EDIT -------------------------------------------------------

Thank dasblinkenlight I got my answer.

A side note, I do not agree with the way ORMLite library UpdateOnly() treats item.Id as a literal "Id", and didn't use its real value.

Meaning this UpdateOnly() function is only good for hard-coded string unit test. It gets weird in practical use.

Not sure if it is by design or a glitch.

1 Answers
Related