示例#1
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)
        {
            Dictionary<string, ColumnMD> columnMap = new Dictionary<string, ColumnMD>();
            m_flattened = true;

            foreach (EdmProperty p in properties)
            {
                ColumnMD newColumn = new ColumnMD(this, p);
                m_columns.Add(newColumn);
                columnMap[p.Name] = newColumn;
            }
            foreach (EdmMember 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)
        {
            Dictionary <string, ColumnMD> columnMap = new Dictionary <string, ColumnMD>();
            m_flattened = true;

            foreach (EdmProperty p in properties)
            {
                ColumnMD newColumn = new ColumnMD(this, p);
                m_columns.Add(newColumn);
                columnMap[p.Name] = newColumn;
            }
            foreach (EdmMember 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
文件: Vars.cs 项目: dox0/DotNet471RS3
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="id"></param>
 /// <param name="table"></param>
 /// <param name="columnMetadata"></param>
 internal ColumnVar(int id, Table table, ColumnMD columnMetadata)
     : base(id, VarType.Column, columnMetadata.Type)
 {
     m_table          = table;
     m_columnMetadata = columnMetadata;
 }
示例#4
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 ColumnVar CreateColumnVar(Table table, ColumnMD columnMD)
 {
     // create a new column var now
     ColumnVar c = new ColumnVar(NewVarId(), table, columnMD);
     table.Columns.Add(c);
     m_vars.Add(c);
     return c;
 }