public static PropertyInfo ParseSelector(LambdaExpression expression) { if (expression.Body is MemberExpression memberExpression && memberExpression.Member is PropertyInfo property && memberExpression.Expression.NodeType == ExpressionType.Parameter) { return(property); } throw BuilderError.SelectorInvalid(expression.Parameters[0].Name).AsException(); }
public async void Table__Error_On_Table_Selector_Not_Property(string selector) { var mb = @"var users = new List<User>(); var _ = mb.Database(nameof(Database)) .Table(d => d.Table(t => " + selector + @") .Column(t => t.UserId, SqlType.Int) .Build()) .Build();"; await VerifyErrorRaised(mb, BuilderError.SelectorInvalid("t"), selector); }
public async void Column__Error_On_Invalid_Column_Selector(string selector, string mb) { await VerifyErrorRaised(mb, BuilderError.SelectorInvalid("t"), selector); }
public async void Error_On_ReferenceTable_Selector_Invalid(string location, string foreignKey) { await VerifyForeignKeyErrorRaised(BuilderError.SelectorInvalid("t"), foreignKey, location); }
public async void Error_On_KeyColumn_OrderedSelector_Invalid(string location, string foreignKey) { await VerifyForeignKeyErrorRaised(BuilderError.SelectorInvalid("t"), foreignKey, location); }
public async void Error_On_IncludedColumn_Selector_Invalid(string location, string index) { await VerifyIndexErrorRaised(BuilderError.SelectorInvalid("t"), location, index); }