protected void AddColumnMetadata(string entityName, string entityAlias, string attributeName) { // Add the metadata for this column. var entityMetadata = GetEntityMetadata(entityName); if (entityMetadata != null) { var colMeta = entityMetadata.Attributes.FirstOrDefault(c => c.LogicalName == attributeName); ColumnMetadata columnMetadata = null; if (colMeta == null) { // could throw an exception as no metadata found for this attribute? // throw new ArgumentException("Unknown column: " + columnAttributeName); columnMetadata = new ColumnMetadata(attributeName, entityAlias); } else { columnMetadata = new ColumnMetadata(colMeta, entityAlias); } ResultColumnMetadata.Add(columnMetadata); } else { // Could throw an exceptiton as no metadata found for this entity. } }
protected void AddAllColumnMetadata(string entityName, string entityAlias) { // Add the metadata for this column. var entityMetadata = GetEntityMetadata(entityName); if (entityMetadata != null) { // Populate metadata for these columns. ResultColumnMetadata.AddRange((from c in entityMetadata.Attributes orderby c.LogicalName select new ColumnMetadata(c, entityAlias))); } else { // Could throw an exceptiton as no metadata found for this entity. } }