Harry Harry - 1 year ago 138
MySQL Question

linq2db update cannot find definition for .Set method MySQL

I am implementing linq2db in my project, currently I am trying to carry out an update but I am stuck on this issue. Now I can see there is no extension method in the class available, however in the demo on github and in the source I can't seem to find anything different from what I am doing. So not sure how to do this.



Answer Source

Make sure you have using LinqToDB; at the top of your class.

This syntax works:

Two lambdas one for the property selector and second for the value.

db.Product.Where(x => x.ProductID == 1).Set(x => x.Name, x => "ABC");

You are going to face a hard time with IntelliSense using this method, unless you right two empty lambadas Set(x=> , x=>), then IntelliSense shows up.