public static MutatorsConfigurator <TRoot, TChild, TValue> Required <TRoot, TChild, TValue>( this MutatorsConfigurator <TRoot, TChild, TValue> configurator, Expression <Func <TChild, TValue, MultiLanguageTextBase> > message, int priority = 0, ValidationResultType type = ValidationResultType.Error) { var pathToValue = (Expression <Func <TRoot, TValue> >)configurator.PathToValue.ReplaceEachWithCurrent(); var pathToChild = (Expression <Func <TRoot, TChild> >)configurator.PathToChild.ReplaceEachWithCurrent(); configurator.SetMutator(RequiredIfConfiguration.Create(MutatorsCreator.Sharp, priority, null, pathToValue, message.Merge(pathToChild, pathToValue), type)); return(configurator); }
public static MutatorsConfigurator <TRoot, TChild, TValue> Required <TRoot, TChild, TValue>( this MutatorsConfigurator <TRoot, TChild, TValue> configurator, Expression <Func <TChild, TValue, MultiLanguageTextBase> > message, int priority = 0, ValidationResultType type = ValidationResultType.Error) { var methodReplacer = new MethodReplacer(MutatorsHelperFunctions.EachMethod, MutatorsHelperFunctions.CurrentMethod); var pathToValue = (Expression <Func <TRoot, TValue> >)methodReplacer.Visit(configurator.PathToValue); var pathToChild = (Expression <Func <TRoot, TChild> >)methodReplacer.Visit(configurator.PathToChild); configurator.SetMutator(RequiredIfConfiguration.Create(MutatorsCreator.Sharp, priority, null, pathToValue, message.Merge(pathToChild, pathToValue), type)); return(configurator); }