示例#1
0
        internal TableMD(
            IEnumerable <EdmProperty> properties, IEnumerable <EdmMember> keyProperties,
            EntitySetBase extent)
            : this(extent)
        {
            var columnMap = new Dictionary <string, ColumnMD>();
            m_flattened = true;

            foreach (var p in properties)
            {
                var newColumn = new ColumnMD(p);
                m_columns.Add(newColumn);
                columnMap[p.Name] = newColumn;
            }
            foreach (var p in keyProperties)
            {
                ColumnMD keyColumn;
                if (!columnMap.TryGetValue(p.Name, out keyColumn))
                {
                    Debug.Assert(false, "keyMember not in columns?");
                }
                else
                {
                    m_keys.Add(keyColumn);
                }
            }
        }
示例#2
0
        /// <summary>
        /// Creates a "flattened" table definition. 
        /// 
        /// The table has one column for each specified property in the "properties" parameter. 
        /// The name and datatype of each table column are taken from the corresponding property.
        /// 
        /// The keys of the table (if any) are those specified in the "keyProperties" parameter
        /// 
        /// The table may correspond to an entity set (if the entityset parameter was non-null)
        /// </summary>
        /// <param name="properties">prperties corresponding to columns of the table</param>
        /// <param name="keyProperties"></param>
        /// <param name="extent">entityset corresponding to the table (if any)</param>
        internal TableMD(
            IEnumerable<EdmProperty> properties, IEnumerable<EdmMember> keyProperties,
            EntitySetBase extent)
            : this(extent)
        {
            var columnMap = new Dictionary<string, ColumnMD>();
            m_flattened = true;

            foreach (var p in properties)
            {
                var newColumn = new ColumnMD(p);
                m_columns.Add(newColumn);
                columnMap[p.Name] = newColumn;
            }
            foreach (var p in keyProperties)
            {
                ColumnMD keyColumn;
                if (!columnMap.TryGetValue(p.Name, out keyColumn))
                {
                    Debug.Assert(false, "keyMember not in columns?");
                }
                else
                {
                    m_keys.Add(keyColumn);
                }
            }
        }
示例#3
0
        internal virtual ColumnVar CreateColumnVar(Table table, ColumnMD columnMD)
        {
            ColumnVar columnVar = new ColumnVar(this.NewVarId(), table, columnMD);

            table.Columns.Add((Var)columnVar);
            this.m_vars.Add((Var)columnVar);
            return(columnVar);
        }
示例#4
0
 internal TableMD(
     IEnumerable <EdmProperty> properties,
     IEnumerable <EdmMember> keyProperties,
     EntitySetBase extent)
     : this(extent)
 {
     Dictionary <string, ColumnMD> dictionary = new Dictionary <string, ColumnMD>();
     this.m_flattened = true;
     foreach (EdmProperty property in properties)
     {
         ColumnMD columnMd = new ColumnMD((EdmMember)property);
         this.m_columns.Add(columnMd);
         dictionary[property.Name] = columnMd;
     }
     foreach (EdmMember keyProperty in keyProperties)
     {
         ColumnMD columnMd;
         if (dictionary.TryGetValue(keyProperty.Name, out columnMd))
         {
             this.m_keys.Add(columnMd);
         }
     }
 }
示例#5
0
 // <summary>
 // Creates a new var for a table column
 // </summary>
 // <param name="table"> The table instance that produces the column </param>
 // <param name="columnMD"> column metadata </param>
 // <returns> A new ColumnVar instance that references the specified column in the given table </returns>
 internal virtual ColumnVar CreateColumnVar(Table table, ColumnMD columnMD)
 {
     // create a new column var now
     var c = new ColumnVar(NewVarId(), table, columnMD);
     table.Columns.Add(c);
     m_vars.Add(c);
     return c;
 }