Exemplo n.º 1
0
        /// <summary>
        ///     Parses a data record into a <see cref="DatabaseIndexColumn" /> instance.
        /// </summary>
        private DomainTableIndexColumn ParseIndexColumn(DomainTableIndex index, IDataRecord record)
        {
            DomainTableIndexColumn indexColumn = index.CreateColumn();

            indexColumn.ReferencedColumn = index.Table.TableColumns.FirstOrDefault(column => column.ColumnName == record["name"].ConvertTo <String>());
            return(indexColumn);
        }
Exemplo n.º 2
0
        /// <summary>
        ///     Creates a new database index within the table.
        /// </summary>
        public DomainTableIndex CreateIndex()
        {
            DomainTableIndex index = new DomainTableIndex(this);

            _tableIndexes.Add(index);
            return(index);
        }
 /// <summary>
 ///     Deserialises the version history from the specified xml element.
 /// </summary>
 internal static void Deserialise(DomainTableIndex index, XmlNode parentNode)
 {
     foreach (XmlNode xmlNode in parentNode.SelectNodes("column"))
     {
         DomainTableIndexColumn result = index.CreateColumn();
         result.Deserialise(xmlNode);
     }
 }
Exemplo n.º 4
0
 /// <summary>
 ///     Deserialises the version history from the specified xml element.
 /// </summary>
 internal static void Deserialise(DomainTable table, XmlNode parentNode)
 {
     foreach (XmlNode xmlNode in parentNode.SelectNodes("index"))
     {
         DomainTableIndex result = table.CreateIndex();
         result.Deserialise(xmlNode);
         DomainTableIndexColumn.Deserialise(result, xmlNode);
     }
 }
Exemplo n.º 5
0
 /// <summary>
 ///     Deserialises the version history from the specified xml element.
 /// </summary>
 internal static void Deserialise(Domain domain, XmlNode parentNode)
 {
     foreach (XmlNode xmlNode in parentNode.SelectNodes("table"))
     {
         DomainTable result = domain.CreateTable();
         result.Deserialise(xmlNode);
         DomainTableColumn.Deserialise(result, xmlNode);
         DomainTableIndex.Deserialise(result, xmlNode);
         DomainTableConstraint.Deserialise(result, xmlNode);
     }
 }
Exemplo n.º 6
0
        /// <summary>
        ///     Parses a data record into a <see cref="DatabaseIndex" /> instance.
        /// </summary>
        private DomainTableIndex ParseIndex(DomainTable table, IDataRecord record)
        {
            DomainTableIndex index = table.CreateIndex();

            index.IndexName     = record["index_name"].ConvertTo <String>();
            index.IndexIsUnique = record["index_unique"].ConvertTo <Boolean>();

            // Import the column information
            this.Execute(rec2 => this.ParseIndexColumn(index, rec2), @"
              select columns.name
              from sys.schemas
              join sys.objects on objects.schema_id = schemas.schema_id 
              join sys.columns on columns.object_id = objects.object_id 
              join sys.indexes on indexes.object_id = objects.object_id
              join sys.index_columns on index_columns.object_id = objects.object_id and index_columns.index_id = indexes.index_id and index_columns.column_id = columns.column_id
              where schemas.name = 'dbo' and objects.type = 'u' and objects.name = @param1 and indexes.index_id = @param2
              order by indexes.type, indexes.index_id", table.TableName, record["index_id"]).ToArray();

            return(index);
        }
 /// <summary>
 ///     Initialises a new <see cref="DomainTableIndexColumn" /> instance.
 /// </summary>
 public DomainTableIndexColumn(DomainTableIndex index) : base(index.Version)
 {
     _index = index;
 }
Exemplo n.º 8
0
 /// <summary>
 ///     Initialises a new <see cref="IndexEditor" /> instance.
 /// </summary>
 public IndexEditor(DomainTableIndex domainTableIndex)
 {
     this.InitializeComponent();
     this.DomainTableIndex = domainTableIndex;
 }