25 where TProperty :
struct
27 ArgumentNullException.ThrowIfNull(model);
28 ArgumentNullException.ThrowIfNull(accessor);
30 var memberSelectorExpression = (MemberExpression)accessor.Body;
31 var
property = (PropertyInfo)memberSelectorExpression.Member;
33 var nullableValue = (TProperty?)property.GetValue(model);
34 if (!nullableValue.HasValue)
35 throw new InvalidOperationException($
"Expected {model.GetType().Name}.{property.Name} to be set here!");
37 return nullableValue.Value;