Skip to content

Commit 429fde6

Browse files
committed
Don't allow . properties in Dapper GetAllForProperty
1 parent faf87d6 commit 429fde6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Griddly.Mvc/Results/DapperResult.cs

+4-1
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ public override void PopulateSummaryValues(GriddlySettings<T> settings)
8181

8282
public override IEnumerable<P> GetAllForProperty<P>(string propertyName)
8383
{
84+
if (propertyName.Contains("."))
85+
throw new ArgumentException($"Property name may not contain a period. \"{propertyName}\"", "propertyName");
86+
8487
string sql = string.Format("SELECT {0} as _val FROM ({1}) [_proj]", propertyName, _sql);
8588

8689
try
@@ -92,7 +95,7 @@ public override IEnumerable<P> GetAllForProperty<P>(string propertyName)
9295
}
9396
catch (Exception ex)
9497
{
95-
throw new DapperGriddlyException($"Error selecting property: {propertyName}.", sql, _param, ex: ex);
98+
throw new DapperGriddlyException($"Error selecting property: {propertyName}.", sql, _param, ex);
9699
}
97100
}
98101

0 commit comments

Comments
 (0)