Browse Source

Added method for updatng CoreRow in place (essentially convenience for Set + Get)

Kenric Nugteren 2 weeks ago
parent
commit
1d187bb4fe
1 changed files with 6 additions and 0 deletions
  1. 6 0
      InABox.Core/CoreTable/CoreRow.cs

+ 6 - 0
InABox.Core/CoreTable/CoreRow.cs

@@ -189,6 +189,12 @@ namespace InABox.Core
             //String colname = CoreUtils.GetFullPropertyName(expression, ".");
             Set(colname, value);
         }
+        public void Update<TSource, TType>(Expression<Func<TSource, TType>> expression, Func<TType, TType> update)
+        {
+            var colname = GetColName(expression);
+            //String colname = CoreUtils.GetFullPropertyName(expression, ".");
+            Set(colname, update(Get<TType>(colname)));
+        }
 
         public void Set<T>(int col, T value)
         {