Class TypedDataRowExtensions
Inheritance
Inherited Members
Namespace: Mediachase.Commerce.Extensions
Assembly: Mediachase.Commerce.dll
Version: 13.30.0Syntax
public static class TypedDataRowExtensions
Methods
Get<TRow, TValue>(TRow, Expression<Func<TRow, TValue>>)
Gets the property value defined in property
from the
instance row
.
Declaration
public static TValue Get<TRow, TValue>(this TRow row, Expression<Func<TRow, TValue>> property)
where TRow : DataRow
Parameters
Type | Name | Description |
---|---|---|
TRow | row | The instance to read the property from. |
System.Linq.Expressions.Expression<System.Func<TRow, TValue>> | property | An System.Linq.Expressions.Expression defining the property to read, e.g. 'x => x.MyProp'
to read the property 'MyProp' from |
Returns
Type | Description |
---|---|
TValue | The property value, with fallback to the default of |
Type Parameters
Name | Description |
---|---|
TRow | The typed System.Data.DataRow. |
TValue | The property value type. |
Set<TRow, TValue>(TRow, Expression<Func<TRow, TValue>>, TValue)
Sets the property value defined in property
on the
instance row
if it doesn't already have the same value.
This avoids marking the data row as modified if the value hasn't changed.
Declaration
public static TRow Set<TRow, TValue>(this TRow row, Expression<Func<TRow, TValue>> property, TValue value)
where TRow : DataRow
Parameters
Type | Name | Description |
---|---|---|
TRow | row | The instance to set the property on. |
System.Linq.Expressions.Expression<System.Func<TRow, TValue>> | property | An System.Linq.Expressions.Expression defining the property to set, e.g. 'x => x.MyProp'
to set the property 'MyProp' from |
TValue | value | The property value to set.
If the System.Data.DataRow.RowState of |
Returns
Type | Description |
---|---|
TRow |
Type Parameters
Name | Description |
---|---|
TRow | The typed System.Data.DataRow. |
TValue | The property value type. |
Set<TRow, TValue>(TRow, Expression<Func<TRow, TValue>>, Nullable<TValue>)
Sets the property value defined in property
on the
instance row
if it doesn't already have the same value.
This avoids marking the data row as modified if the value hasn't changed.
Declaration
public static TRow Set<TRow, TValue>(this TRow row, Expression<Func<TRow, TValue>> property, TValue? value)
where TRow : DataRow where TValue : struct
Parameters
Type | Name | Description |
---|---|---|
TRow | row | The instance to set the property on. |
System.Linq.Expressions.Expression<System.Func<TRow, TValue>> | property | An System.Linq.Expressions.Expression defining the property to set, e.g. 'x => x.MyProp'
to set the property 'MyProp' from |
System.Nullable<TValue> | value | The property value to set.
If the System.Data.DataRow.RowState of |
Returns
Type | Description |
---|---|
TRow |
Type Parameters
Name | Description |
---|---|
TRow | The typed System.Data.DataRow. |
TValue | The property value type. |
TryGet<TRow, TValue>(TRow, Expression<Func<TRow, TValue>>, out Boolean)
Gets the property value defined in property
from the
instance row
.
Declaration
public static TValue TryGet<TRow, TValue>(this TRow row, Expression<Func<TRow, TValue>> property, out bool isNull)
where TRow : DataRow
Parameters
Type | Name | Description |
---|---|---|
TRow | row | The instance to read the property from. |
System.Linq.Expressions.Expression<System.Func<TRow, TValue>> | property | An System.Linq.Expressions.Expression defining the property to read, e.g. |
System.Boolean | isNull | Output parameter which will be set to |
Returns
Type | Description |
---|---|
TValue | The property value, with fallback to the default of |
Type Parameters
Name | Description |
---|---|
TRow | The typed System.Data.DataRow. |
TValue | The property value type. |