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