Esempio n. 1
0
        public static void AddColumn(this key thisKey, column column)
        {
            if (thisKey.column == null)
                thisKey.column = new column[0];

            column[] items = thisKey.column;
            Array.Resize(ref items, thisKey.column.Length + 1);
            items[items.Length - 1] = column;
            thisKey.column = items;
        }
        public static void AddColumn(this manytoone thisManyToOne, column column)
        {
            //throw new NotImplementedException("TODO: What are we meant to do here?");

            //if (thisManyToOne.column == null)
            //    thisManyToOne.column = new column[0];

            //var items = thisManyToOne.column;
            //Array.Resize(ref items, thisManyToOne.column.Length + 1);
            //items[items.Length - 1] = column;
            //thisManyToOne.column = items;

            if (thisManyToOne.Items == null)
                thisManyToOne.Items = new column[0];

            var items = thisManyToOne.Items;
            Array.Resize(ref items, thisManyToOne.Items.Length + 1);
            items[items.Length - 1] = column;
            thisManyToOne.Items = items;
        }
Esempio n. 3
0
        private static IEnumerable<column> GetColumnNodes(IEnumerable<IColumn> columns)
        {
            List<column> columnNodes = new List<column>();

            foreach (var mappedColumn in columns)
            {
                var columnNode = new column { name = mappedColumn.Name.BackTick() };
                columnNodes.Add(columnNode);
            }
            return columnNodes;
        }
Esempio n. 4
0
        private key GetKeyNode(ITable joinedTable)
        {
            int count = joinedTable.ColumnsInPrimaryKey.Count();
            key keyNode = new key();

            if (count > 1)
            {
                foreach (var col in joinedTable.ColumnsInPrimaryKey)
                {
                    column column = new column { name = col.Name };
                    keyNode.AddColumn(column);
                }
            }
            else if (count == 1)
                keyNode.column1 = joinedTable.ColumnsInPrimaryKey.First().Name.BackTick();

            return keyNode;
        }