DataSetViewSchema.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / WebForms / System / Web / UI / Design / DataSetViewSchema.cs / 1 / DataSetViewSchema.cs

                            //------------------------------------------------------------------------------ 
// 
//     Copyright (c) Microsoft Corporation.  All rights reserved.
// 
//----------------------------------------------------------------------------- 

namespace System.Web.UI.Design { 
 
    using System.Data;
 
    /// 
    ///    
    ///       Provides schema information for a single data source view.  This schema information is used at
    ///       at designtime to make decisions about what views should be shown in the 
    ///       DataMember picker.
    ///     
    ///  
    public sealed class DataSetViewSchema : IDataSourceViewSchema {
 
        private DataTable _dataTable;

        public DataSetViewSchema(DataTable dataTable) {
            if (dataTable == null) { 
                throw new ArgumentNullException("dataTable");
            } 
            _dataTable = dataTable; 
        }
 
        /// 
        /// Returns the name of the view.  This name should match the name returned by the runtime method GetViewNames.
        /// 
        public string Name { 
             get {
                 return _dataTable.TableName; 
             } 
        }
 
        /// 
        /// Returns an array of IDataSourceViewSchema objects that represent the child views contained in the current view.
        /// 
        public IDataSourceViewSchema[] GetChildren() { 
            return null;    // todo: implement for hierarchy
        } 
 
        /// 
        /// Returns an array of IDataSourceFieldSchema objects that represent the fields contained in the view. 
        /// 
        public IDataSourceFieldSchema[] GetFields() {
            System.Collections.Generic.List fieldSchemas = new System.Collections.Generic.List();
            foreach (DataColumn c in _dataTable.Columns) { 
                if (c.ColumnMapping != MappingType.Hidden) {
                    fieldSchemas.Add(new DataSetFieldSchema(c)); 
                } 
            }
 
            return fieldSchemas.ToArray();
        }
    }
} 


// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK