Skip to content

Commit

Permalink
Merge pull request #780 from stsrki/dev091-datagrid-null-field
Browse files Browse the repository at this point in the history
fix: DataGrid must be specified
  • Loading branch information
stsrki committed Apr 21, 2020
2 parents 09983a5 + 60dfef1 commit ab07588
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ public static Func<TItem> CreateNewItem<TItem>()
/// <returns>Returns the requested field if it exists.</returns>
private static Expression GetSafeField( Expression item, string fieldName )
{
if ( string.IsNullOrEmpty( fieldName ) )
throw new ArgumentException( $"{nameof( fieldName )} is not specified." );

var parts = fieldName.Split( new char[] { '.' }, 2 );

Expression field = Expression.PropertyOrField( item, parts[0] );
Expand Down Expand Up @@ -58,6 +61,9 @@ private static bool IsNullable( Type type )
/// <returns>Returns the requested field if it exists.</returns>
private static Expression GetField( Expression item, string fieldName )
{
if ( string.IsNullOrEmpty( fieldName ) )
throw new ArgumentException( $"{nameof( fieldName )} is not specified." );

var parts = fieldName.Split( new char[] { '.' }, 2 );

Expression subProperty = Expression.PropertyOrField( item, parts[0] );
Expand Down

0 comments on commit ab07588

Please sign in to comment.