public InMemoryRowMatcher(Row row, QueryExpression queryExpression, string tableIdentifier = null)
 {
     _row = row;
     _queryExpression = queryExpression;
     _tableIdentifier = tableIdentifier;
 }
 public QueryExpressionRowMatcher(Row row)
 {
     _row = row;
 }
 public void SetUp()
 {
     _row = new Row();
     _mapper = new EntityMapper(new ConventionReader(new DefaultConvention()));
     _parentChildRelation = ObjectRelation.CreateTwoWay<Parent, Child>(x => x.Children, x => x.Parent);
     _childParentRelation = ObjectRelation.CreateTwoWay<Parent, Child>(x => x.Children, x => x.Parent);
     _childGrandChildRelation = ObjectRelation.CreateTwoWay<Child, GrandChild>(x => x.GrandChildren, x => x.Child);
     _idLessRelation = ObjectRelation.CreateTwoWay<ParentWithoutId, ChildWithoutId>(x => x.Children, x => x.Parent);
 }
Beispiel #4
0
        private static IEnumerable<Row> GetMatchingRows(Row row, ResultSet joinedTable, string leftTableIdentifier, string leftColumnName, string rightTableIdentifier, string rightColumnName)
        {
            // This code is messy... The deal is that we don't know if the left table identifier + column name
            // is found in the joined table or the original table, and the same for the right.
            // TODO: This should be refactored when I have the energy.

            ColumnValue leftValue = null, rightValue = null;

            var matchingRows = new List<Row>();

            var isJoinedTableRight = row.HasValuesForTable(leftTableIdentifier);

            if (isJoinedTableRight)
            {
                leftValue = row.GetColumnValue(leftTableIdentifier, leftColumnName);
            }
            else
            {
                rightValue = row.GetColumnValue(rightTableIdentifier, rightColumnName);
            }

            foreach (var joinedRow in joinedTable.Rows)
            {
                if (isJoinedTableRight)
                {
                    rightValue = joinedRow.GetColumnValue(rightTableIdentifier, rightColumnName);
                }
                else
                {
                    leftValue = joinedRow.GetColumnValue(leftTableIdentifier, leftColumnName);
                }

                if (Equals(leftValue.Value, rightValue.Value))
                    matchingRows.Add(joinedRow);
            }

            return matchingRows;
        }
Beispiel #5
0
 public void Remove(Row row)
 {
     Rows.Remove(row);
 }
Beispiel #6
0
 public void AddRow(IEnumerable<ColumnValue> columnValues)
 {
     var row = new Row(columnValues);
     Rows.Add(row);
 }
Beispiel #7
0
 public void AddRow(Row row)
 {
     AddRow(row.ColumnValues);
 }