querybuilder icon indicating copy to clipboard operation
querybuilder copied to clipboard

[Ignore] atbt discerning Insert/Update

Open 7CMiguel opened this issue 1 year ago • 3 comments

https://github.com/sqlkata/querybuilder/issues/721 Related issue

7CMiguel avatar Jul 23 '24 14:07 7CMiguel

Nice feature!, I suggested to reuse the existing Ignore attribute, and please add test to cover this change

ahmad-moussawi avatar Feb 03 '25 08:02 ahmad-moussawi

@ahmad-moussawi also about considerKeys, on Update/Insert, i was thinking that when is true it should be able to put the Where despite this attb being [Ignore], in my case we are using [Key, Ignore] for Ids, bcos they auto generate in db but for keys we want to insert we just avoid the [Ignore], but i need to put myself for the update.Where(keys, keys.value) more than 1 where if needed for complex keys, but if we would leave this outside can be usefull. What d u think.

Instead of if (property.GetCustomAttribute(typeof(IgnoreAttribute)) != null) { continue; } First and then if (considerKeys && colAttr != null) { if ((colAttr as KeyAttribute) != null) { this.Where(name, value); } } Put the consider keys + Where first and then the continue

7CMiguel avatar Mar 04 '25 11:03 7CMiguel

@ahmad-moussawi changes aplied + UT to check the ignore on diferent cases.

7CMiguel avatar Mar 07 '25 17:03 7CMiguel