nHydrate.Generator.Models.CustomView.GetColumns C# (CSharp) Method

GetColumns() public method

Returns the column for this object
public GetColumns ( ) : IEnumerable
return IEnumerable
        public IEnumerable<CustomViewColumn> GetColumns()
        {
            try
            {
                var retval = new List<CustomViewColumn>();
                foreach (Reference r in this.Columns)
                {
                    retval.Add((CustomViewColumn)r.Object);
                }
                retval.RemoveAll(x => x == null);
                return retval.OrderBy(x => x.Name);
            }
            catch (Exception ex)
            {
                throw;
            }
        }

Usage Example

示例#1
0
        /// <summary>
        /// Find all relationships that have a specific child table
        /// </summary>
        /// <param name="table">The table from which all relations begin</param>
        /// <param name="includeHierarchy">Determines if the return includes all tables in the inheritence tree</param>
        /// <returns></returns>
        public ReadOnlyCollection <ViewRelation> FindByChildTable(CustomView table)
        {
            try
            {
                var retval     = new List <ViewRelation>();
                var tableList  = new List <Table>();
                var columnList = new List <CustomViewColumn>();
                tableList = new List <Table>();
                columnList.AddRange(table.GetColumns());

                foreach (ViewRelation relation in this)
                {
                    var childTable = relation.ChildView;
                    foreach (ViewColumnRelationship columnRelationship in relation.ColumnRelationships)
                    {
                        foreach (var column in columnList)
                        {
                            if (!retval.Contains(relation))
                            {
                                retval.Add(relation);
                            }
                        }
                    }
                }

                return(retval.AsReadOnly());
            }
            catch (Exception ex)
            {
                throw;
            }
        }
All Usage Examples Of nHydrate.Generator.Models.CustomView::GetColumns