internal static void PropertyMappingIsSet <TRunInfo, TProperty>(PropertyArgument <TRunInfo, TProperty> argument, int commandLevel) where TRunInfo : class { if (argument.Property == null) { throw new CommandValidationException("Property Argument is missing its property mapping expression.", CommandValidationError.NullPropertyExpression, commandLevel); } }
internal static List <Action <int> > Rules <TRunInfo, TProperty>(PropertyArgument <TRunInfo, TProperty> argument) where TRunInfo : class { return(new List <Action <int> > { PropertyMappingIsSet(argument), MappedPropertyIsWritable(argument) }); }
internal static void MappedPropertyIsWritable <TRunInfo, TProperty>(PropertyArgument <TRunInfo, TProperty> argument, int commandLevel) where TRunInfo : class { if (!ReflectionHelper <TRunInfo> .PropertyIsWritable(argument.Property, out string propertyName)) { throw new CommandValidationException($"Property Argument's property '{propertyName}' " + "is not writable. Try adding a setter.", CommandValidationError.PropertyNotWritable, commandLevel); } }
private static Action <int> PropertyMappingIsSet <TRunInfo, TProperty>(PropertyArgument <TRunInfo, TProperty> argument) where TRunInfo : class { return(commandLevel => { if (argument.Property == null) { throw new CommandValidationException("Property Argument is missing its property mapping expression.", CommandValidationError.NullPropertyExpression, commandLevel); } }); }