浏览代码

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

Kenric Nugteren 9 月之前
父节点
当前提交
1d187bb4fe
共有 1 个文件被更改,包括 6 次插入0 次删除
  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)
         {