示例#1
0
 internal static List <Action <int> > Rules <TRunInfo, TListProperty>(SequenceArgument <TRunInfo, TListProperty> argument)
     where TRunInfo : class
 {
     return(new List <Action <int> >
     {
         MappedPropertyMustBeSet(argument),
         MappedPropertyIsWritable(argument)
     });
 }
示例#2
0
 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);
     }
 }
示例#3
0
 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);
     }
 }
示例#4
0
 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);
         }
     });
 }