Search code examples
c#sqlkata

How to ignore a property when doing Insert or Update but not in Get in SqlKata


In MySql database, I have columns "created" and "updated" which are marked with CURRENT_TIMESTAMP and ON UPDATE CURRENT_TIMESTAMP respectively. I never want to manually update these fields, but I do want to read them. SqlKata has Ignore property, but that completely ignores it (surprise!). Is there something like IgnoreOnInsert or similar workaround?

Now I go around this by having a sub-object that does not have these 2 properties, but this is not nice.


Solution

  • The Ignore attribute only affect Insert/Update operations, select statements are not affected.