Contains a collection of Column classes.
Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Table"/> class.
        /// </summary>
        /// <param name="owner">The owner.</param>
        /// <param name="name">The name.</param>
		public Table(string owner, string name) 
        {
			Owner = owner;
			Name = name;
            Columns = new Columns();
            Constraints = new List<Constraint>();
		}
Ejemplo n.º 2
0
 public void Remove_Column()
 {
     var test = new Columns();
     var column = new Column("testing", ColumnTypes.Bigint, true, null);
     test.Add(column);
     test.Remove(column);
     Assert.False(test.Items.Any(item => item.Name == "testing"));
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Translates this constraint into a SQL script
 /// </summary>
 /// <returns></returns>
 public string Script()
 {
     return(Type != ConstraintType.Index
         ?
            $"CONSTRAINT [{Name}] {ConvertToString(Type)} {ClusteredText} ([{string.Join("], [", Columns.ToArray())}])"
         :
            $"CREATE {UniqueText} {ClusteredText} INDEX [{Name}] ON [{Table.Owner}].[{Table.Name}] ([{string.Join("], [", Columns.ToArray())}])");
 }
Ejemplo n.º 4
0
 public void Script()
 {
     var test = new Columns();
     test.Add(new Column("testing", ColumnTypes.Bigint, true, null));
     Assert.Contains("testing", test.Script());
 }
Ejemplo n.º 5
0
 public void Add_Column()
 {
     var test = new Columns();
     test.Add(new Column("testing", ColumnTypes.Bigint, true, null));
     Assert.True(test.Items.Any(item => item.Name == "testing"));
 }