Explorar el Código

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

Kenric Nugteren hace 9 meses
padre
commit
1d187bb4fe
Se han modificado 1 ficheros con 6 adiciones y 0 borrados
  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)
         {