/// <summary>
        /// Constructor.
        /// </summary>
        internal EntityViewPropertyCollection(EntityViewCollection entityView)
        {
            if (entityView == null)
            {
                throw new ArgumentNullException("entityView");
            }

            _entityView = entityView;
        }
示例#2
0
        /// <summary>
        /// Gets the entity collection as a data table.
        /// </summary>
        /// <returns></returns>
        public DataTable ToDataTable()
        {
            // get a view that just contains fields (i.e. don't include parent link entities)...
            if (EntityType == null)
            {
                throw new InvalidOperationException("EntityType is null.");
            }
            EntityViewCollection view = this.GetView(this.EntityType.Fields);

            // create a transformer...
            DataTableTransformer transformer = new DataTableTransformer();

            // transform...
            return(transformer.Transform(view));
        }