DotNetWorkQueue.Transport.SQLite.Schema.Columns.Script C# (CSharp) Method

Script() public method

Translates this list of columns into SQL script.
public Script ( ) : string
return string
		public string Script() 
        {
            var text = new StringBuilder();
			foreach (var c in _columns) 
            {
				text.Append("   " + c.Script());
                if (_columns.IndexOf(c) < _columns.Count - 1) 
                {
					text.AppendLine(",");
				}
				else 
                {
					text.AppendLine();
				}
			}
			return text.ToString();
        }
        #endregion

Usage Example

Esempio n. 1
0
        /// <summary>
        /// Translates this table into a SQL script
        /// </summary>
        /// <returns></returns>
        public string Script()
        {
            var text = new StringBuilder();

            text.AppendFormat("CREATE TABLE [{0}](\r\n", Name);
            text.Append(Columns.Script());
            if (Constraints.Count > 0)
            {
                text.AppendLine();
            }
            //add primary keys
            foreach (var c in Constraints.Where(c => c.Type == ConstraintType.PrimaryKey))
            {
                text.AppendLine("   ," + c.Script());
            }
            text.AppendLine(");");
            text.AppendLine();

            //add indexes and constraints
            foreach (var c in Constraints.Where(c => c.Type != ConstraintType.PrimaryKey))
            {
                text.AppendLine(c.Script());
            }
            return(text.ToString());
        }
All Usage Examples Of DotNetWorkQueue.Transport.SQLite.Schema.Columns::Script