[Adapdev-commits] Adapdev/src/Adapdev.Data/Schema TableSchema.cs,1.4,1.5
Status: Beta
Brought to you by:
intesar66
From: jhbate <jh...@us...> - 2005-11-06 09:47:26
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.Data/Schema In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30737/src/Adapdev.Data/Schema Modified Files: TableSchema.cs Log Message: Changes made for schema xml serialization. Uses custom SchemaDataRewritableAttribute attribute to indicate if a property is to be uppdated. Added Xml tags to properties Index: TableSchema.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Data/Schema/TableSchema.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TableSchema.cs 18 Sep 2005 03:04:45 -0000 1.4 --- TableSchema.cs 6 Nov 2005 09:47:18 -0000 1.5 *************** *** 3,7 **** --- 3,10 ---- using System; using System.Collections; + using System.Xml.Serialization; + using Adapdev.Attributes; using Adapdev.Text; + /// <summary> *************** *** 9,14 **** /// </summary> [Serializable] ! public class TableSchema { protected TableType tableType = TableType.TABLE; protected bool _active = true; --- 12,18 ---- /// </summary> [Serializable] ! public class TableSchema { + protected TableType tableType = TableType.TABLE; protected bool _active = true; *************** *** 55,59 **** /// </summary> /// <param name="name">The name of the ColumnSchema to retrieve</param> ! /// <returns></returns> public ColumnSchema GetColumn(string name) { --- 59,63 ---- /// </summary> /// <param name="name">The name of the ColumnSchema to retrieve</param> ! /// <returns></returns> public ColumnSchema GetColumn(string name) { *************** *** 70,138 **** } ! /// <summary> ! /// Returns a collection of ColumnSchemas ! /// </summary> ! /// <returns></returns> ! public ColumnSchemaDictionary Columns ! { ! get{return this.columns;} ! set{this.columns = value;} ! } ! ! /// <summary> ! /// Returns a collection of ColumnSchemas that are primary keys ! /// </summary> ! /// <returns></returns> ! public ColumnSchemaDictionary PrimaryKeys ! { ! get ! { ! ColumnSchemaDictionary pks = new ColumnSchemaDictionary(); ! foreach(ColumnSchema c in this.columns.Values) ! { ! if(c.IsPrimaryKey)pks[c.Name] = c; ! } ! return pks; ! } ! } /// <summary> ! /// Returns a collection of ColumnSchemas that are foreign keys /// </summary> /// <returns></returns> ! public ColumnSchemaDictionary ForeignKeys { get { ! ColumnSchemaDictionary fks = new ColumnSchemaDictionary(); ! foreach(ColumnSchema c in this.columns.Values) { ! if(c.IsForeignKey)fks[c.Name] = c; } ! return fks; } } /// <summary> - /// Gets the number of primary keys - /// </summary> - /// <returns></returns> - public int PrimaryKeyCount - { - get - { - int i = 0; - foreach (ColumnSchema c in columns.Values) - { - if(c.IsPrimaryKey)i++; - } - return i; - } - } - - /// <summary> /// Gets the number of foreign keys /// </summary> /// <returns></returns> public int ForeignKeyCount { --- 74,104 ---- } ! /// <summary> ! /// Gets the number of primary keys /// </summary> /// <returns></returns> ! [XmlAttribute] ! [SchemaDataRewritableAttribute(false)] ! public int PrimaryKeyCount { get { ! int i = 0; ! foreach (ColumnSchema c in columns.Values) { ! if(c.IsPrimaryKey)i++; } ! return i; } } /// <summary> /// Gets the number of foreign keys /// </summary> /// <returns></returns> + [XmlAttribute] + [SchemaDataRewritableAttribute(false)] public int ForeignKeyCount { *************** *** 184,187 **** --- 150,154 ---- /// </summary> /// <returns></returns> + [XmlIgnore] public SortedList OrdinalColumns { *************** *** 201,204 **** --- 168,172 ---- /// </summary> /// <returns></returns> + [XmlIgnore] public SortedList SortedColumns { *************** *** 218,221 **** --- 186,191 ---- /// </summary> /// <returns></returns> + [XmlAttribute] + [SchemaDataRewritableAttribute(false)] public string ProperName { *************** *** 228,231 **** --- 198,203 ---- /// be part of a DatabaseSchema, but ignored for various reasons /// </summary> + [XmlAttribute] + [SchemaDataRewritableAttribute(false)] public bool IsActive { *************** *** 237,240 **** --- 209,214 ---- /// The table name /// </summary> + [XmlAttribute] + [SchemaDataRewritableAttribute(true)] public string Name { *************** *** 246,249 **** --- 220,225 ---- /// The table alias /// </summary> + [XmlAttribute] + [SchemaDataRewritableAttribute(false)] public string Alias { *************** *** 256,259 **** --- 232,237 ---- } + [XmlAttribute] + [SchemaDataRewritableAttribute(false)] public bool HasForeignKeys { *************** *** 265,268 **** --- 243,248 ---- } + [XmlAttribute] + [SchemaDataRewritableAttribute(false)] public bool HasPrimaryKeys { *************** *** 274,277 **** --- 254,304 ---- } + /// <summary> + /// Returns a collection of ColumnSchemas + /// </summary> + /// <returns></returns> + [XmlElement(Type = typeof(ColumnSchemaDictionary), ElementName = "Columns")] + public ColumnSchemaDictionary Columns + { + get{return this.columns;} + set{this.columns = value;} + } + + /// <summary> + /// Returns a collection of ColumnSchemas that are primary keys + /// </summary> + /// <returns></returns> + [XmlElement(Type = typeof(ColumnSchemaDictionary), ElementName = "PrimaryKeys")] + public ColumnSchemaDictionary PrimaryKeys + { + get + { + ColumnSchemaDictionary pks = new ColumnSchemaDictionary(); + foreach(ColumnSchema c in this.columns.Values) + { + if(c.IsPrimaryKey)pks[c.Name] = c; + } + return pks; + } + } + + /// <summary> + /// Returns a collection of ColumnSchemas that are foreign keys + /// </summary> + /// <returns></returns> + [XmlElement(Type = typeof(ColumnSchemaDictionary), ElementName = "ForeignKeys")] + public ColumnSchemaDictionary ForeignKeys + { + get + { + ColumnSchemaDictionary fks = new ColumnSchemaDictionary(); + foreach(ColumnSchema c in this.columns.Values) + { + if(c.IsForeignKey)fks[c.Name] = c; + } + return fks; + } + } + public override string ToString() { |