Пример #1
0
 public InMemoryRowMatcher(Row row, QueryExpression queryExpression, string tableIdentifier = null)
 {
     _row = row;
     _queryExpression = queryExpression;
     _tableIdentifier = tableIdentifier;
 }
 public QueryExpressionRowMatcher(Row row)
 {
     _row = row;
 }
Пример #3
0
 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);
 }
Пример #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;
        }
Пример #5
0
 public void Remove(Row row)
 {
     Rows.Remove(row);
 }
Пример #6
0
 public void AddRow(IEnumerable<ColumnValue> columnValues)
 {
     var row = new Row(columnValues);
     Rows.Add(row);
 }
Пример #7
0
 public void AddRow(Row row)
 {
     AddRow(row.ColumnValues);
 }