public bool IsSpecialColumn(esColumnMetadata col)
        {
            if (DateAdded != null && DateAdded.IsEnabled && DateAdded.ColumnName == col.Name) return true;
            if (DateModified != null && DateModified.IsEnabled && DateModified.ColumnName == col.Name) return true;
            if (AddedBy != null && AddedBy.IsEnabled && AddedBy.ColumnName == col.Name) return true;
            if (ModifiedBy != null && ModifiedBy.IsEnabled && ModifiedBy.ColumnName == col.Name) return true;

            return false;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Searches for an esColumnMetadata by the propery name.
        /// </summary>
        /// <param name="propertyName">The high level PropertyName, for example, Employees.PropertyNames.LastName</param>
        /// <returns>The esColumnMetadata or null if not found.</returns>
        public esColumnMetadata FindByPropertyName(string propertyName)
        {
            esColumnMetadata col = null;

            if (this.hashByPropertyName.ContainsKey(propertyName))
            {
                col = this.hashByPropertyName[propertyName];
            }

            return(col);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Searches for an esColumnMetadata by the propery name. This method is the same as
        /// using the indexer.
        /// </summary>
        /// <param name="columnName">The high level PropertyName, for example, Employees.ColumnNames.LastName</param>
        /// <returns>The esColumnMetadata or null if not found.</returns>
        public esColumnMetadata FindByColumnName(string columnName)
        {
            esColumnMetadata col = null;

            if (this.hashByColumnName.ContainsKey(columnName))
            {
                col = this.hashByColumnName[columnName];
            }

            return(col);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Provides direct access into the collection by column name.
        /// </summary>
        /// <param name="columnName">The name of the desired column. This parameter is expected
        /// to be the physical name of the column as in the table or view, for example,
        /// Employees.ColumnNames.LastName</param>
        /// <returns></returns>
        public esColumnMetadata this[System.String columnName]
        {
            get
            {
                esColumnMetadata col = null;

                if (this.hashByColumnName.ContainsKey(columnName))
                {
                    col = this.hashByColumnName[columnName];
                }

                return(col);
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Used internally by EntitySpaces. This should never be called by user code
        /// </summary>
        /// <param name="column">The new esColumnMetadata to add to the array</param>
        public void Add(esColumnMetadata column)
        {
            list.Add(column);
            hashByColumnName[column.Name]           = column;
            hashByPropertyName[column.PropertyName] = column;

            if (column.HasDefault)
            {
                this.thereAreDefaults = true;
            }

            if (column.IsInPrimaryKey)
            {
                this.primaryKeys.Add(column);
            }
        }
Exemplo n.º 6
0
        public bool IsSpecialColumn(esColumnMetadata col)
        {
            if (DateAdded != null && DateAdded.IsEnabled && DateAdded.ColumnName == col.Name)
            {
                return(true);
            }
            if (DateModified != null && DateModified.IsEnabled && DateModified.ColumnName == col.Name)
            {
                return(true);
            }
            if (AddedBy != null && AddedBy.IsEnabled && AddedBy.ColumnName == col.Name)
            {
                return(true);
            }
            if (ModifiedBy != null && ModifiedBy.IsEnabled && ModifiedBy.ColumnName == col.Name)
            {
                return(true);
            }

            return(false);
        }
        /// <summary>
        /// Used internally by EntitySpaces. This should never be called by user code
        /// </summary>
        /// <param name="column">The new esColumnMetadata to add to the array</param>
        public void Add(esColumnMetadata column)
        {
            list.Add(column);
            hashByColumnName[column.Name] = column;
            hashByPropertyName[column.PropertyName] = column;

            if (column.HasDefault)
            {
                this.thereAreDefaults = true;
            }

            if (column.IsInPrimaryKey)
            {
                this.primaryKeys.Add(column);
            }
        }
        public esColumnMetadataCollection GetColumns(esEntityCollectionBase collection)
        {
            collection.EnableHierarchicalBinding = false;

            PropertyDescriptorCollection props = null;

            try
            {
                MethodInfo GetEntity = collection.GetType().GetMethod("CreateEntity", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
                esEntity entity = GetEntity.Invoke(collection, null) as esEntity;

                MethodInfo GetProperties = collection.GetType().GetMethod("GetProperties", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
                props = GetProperties.Invoke(collection, new object[] { entity }) as PropertyDescriptorCollection;
            }
            catch { }

            MethodInfo get_Meta = collection.GetType().GetMethod("get_Meta", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
            IMetadata meta = get_Meta.Invoke(collection, null) as IMetadata;
            esColumnMetadataCollection esColumns =  meta.Columns;

            esColumnMetadataCollection esCollection = new esColumnMetadataCollection();
            try
            {
                foreach (esColumnMetadata col in esColumns)
                {
                    esCollection.Add(col);
                }
            }
            catch { }

            try
            {
                if (props != null)
                {
                    esExtendedPropertyAttribute att = new esExtendedPropertyAttribute();
                    foreach (PropertyDescriptor prop in props)
                    {
                        if (esColumns.FindByPropertyName(prop.Name) == null)
                        {
                            if (prop.Attributes.Contains(att))
                            {
                                esColumnMetadata col = new esColumnMetadata(prop.Name, 1000, prop.PropertyType);
                                col.PropertyName = prop.Name;
                                esCollection.Add(col);
                            }
                        }
                    }
                }
            }
            catch { }

            return esCollection;
        }