public LinkConfig Link <TU, TV>(Expression <Func <TU, object> > expression1, Expression <Func <TV, object> > expression2, LinkType linkType = LinkType.Object) { var linkName = Expressions.GetPropertyName(expression1.Body); if (linkType == LinkType.Object) { var pos = linkName.LastIndexOf("."); if (pos != -1) { linkName = linkName.Substring(0, pos); } else { linkName = FindLinkName(typeof(TV)); } } var link = new LinkConfig(Type, linkName, linkType); Links.Add(link); _currentLink = link; _currentLink.Link(expression1, expression2); return(_currentLink); }
public CustomRule(Expression <Func <T, object> > expression, Func <T, string> validateMethod) { _validateMethod = validateMethod; RuleType = RuleType.Custom; PropertyName = Expressions.GetPropertyName(expression.Body); }
internal void GetFrom <T>(Expression <Func <T, object> > expression, LinkConfig link) { _getFromType = typeof(T); _getFromProperty = Expressions.GetPropertyName(expression.Body); _link = link; }
internal LinkConfig Link <TU, TV>(Expression <Func <TU, object> > expression1, Expression <Func <TV, object> > expression2) { LeftType = typeof(TU); RightType = typeof(TV); LeftPropertyName = Expressions.GetPropertyName(expression1.Body); RightPropertyName = Expressions.GetPropertyName(expression2.Body); return(this); }
public MappingConfig <T> Property(Expression <Func <T, object> > expression) { var body = expression.Body; var propertyName = Expressions.GetPropertyName(body); var property = new PropertyConfig(Type, propertyName); Properties.Add(property); _currentProperty = property; return(this); }
internal void Setup <T>(Expression <Func <T, object> > expression) { PropertyName = Expressions.GetPropertyName(expression.Body); ObjectType = typeof(T); }