Beispiel #1
0
            static ViewColumnNode.IViewColumnNode BuildOrGetColumnNode(ViewTable vTable, Database.MetaColumn metaColumn, string columnName, Operation.ExpressionParsingContext expressionParsingContext)
            {
                var column = vTable.GetColumnByName(columnName);

                if (column == null)
                {
                    var            columnNode     = (ViewColumnNode.IViewColumnNode)Operation.ColumnCreator.CreateColumn(typeof(ViewColumnNodeTyped <>), metaColumn.Type);
                    ViewColumnNode viewColumnNode = new ViewColumnNode(vTable, metaColumn, expressionParsingContext);

                    columnNode.SetColumn(viewColumnNode);
                    vTable.SetColumn(metaColumn, columnNode.GetColumn());
                    return(columnNode);
                }

                // View table use expand column to decorate the IViewColumnNode with required functionality for expanding rows.
                // So we need to get the underlying column, which is the IViewColumnNode we want.
                if (column is IColumnDecorator)
                {
                    column = (column as IColumnDecorator).GetBaseColumn();
                }

                if (column is ViewColumnNode.IViewColumnNode)
                {
                    return((ViewColumnNode.IViewColumnNode)column);
                }
                else
                {
                    throw new Exception("Expecting column  '" + vTable.GetName() + "." + metaColumn.Name + "' to be a from a node data type (ViewColumnNode) but is of type '" + column.GetType().Name + "'");
                }
            }
Beispiel #2
0
            //Create a column that merge the result of all sub nodes
            static public Column BuildColumnNodeMerge(ViewTable vTable, Database.MetaColumn metaColumn, Operation.ExpressionParsingContext expressionParsingContext)
            {
                var            columnNode     = (ViewColumnNode.IViewColumnNode)Operation.ColumnCreator.CreateColumn(typeof(ViewColumnNodeMergeTyped <>), metaColumn.Type);
                ViewColumnNode viewColumnNode = new ViewColumnNode(vTable, metaColumn, expressionParsingContext);

                columnNode.SetColumn(viewColumnNode);
                return(columnNode.GetColumn());
            }
 void ViewColumnNode.IViewColumnNode.SetColumn(ViewColumnNode vc)
 {
     if (m_ViewColumn != null)
     {
         throw new InvalidOperationException("Cannot call 'ViewColumn.IViewColumn.SetColumn' once already set");
     }
     if (vc.viewTable.node.data.type != ViewTable.Builder.Node.Data.DataType.Node)
     {
         throw new Exception("Cannot set a ViewColumnNodeTyped column on a non-Node data type view table");
     }
     m_ViewColumn = vc;
     entries      = new Operation.TypedExpression <DataT> [vc.viewTable.GetNodeChildCount()];
     m_Cache.InitDirect(entries.Length);
     linkEntries = new TableLink[vc.viewTable.GetNodeChildCount()];
 }
 void ViewColumnNode.IViewColumnNode.SetColumn(ViewColumnNode vc)
 {
     m_ViewColumnNode = vc;
 }