Beispiel #1
0
 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);
     }
 }
Beispiel #2
0
 internal static List <Action <int> > Rules <TRunInfo, TProperty>(PropertyArgument <TRunInfo, TProperty> argument)
     where TRunInfo : class
 {
     return(new List <Action <int> >
     {
         PropertyMappingIsSet(argument),
         MappedPropertyIsWritable(argument)
     });
 }
Beispiel #3
0
 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);
     }
 }
Beispiel #4
0
 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);
         }
     });
 }