public string DescribeStream(string stream) { StringTheory theory = new StringTheory("<stream name=\"%stream%\">\n%fields%</stream>\n"); StringTheory theory2 = new StringTheory(); ArrayList list = new ArrayList(); this.ListColumns(stream, list); theory.Replace("%stream%", stream); foreach (Hashtable hashtable in list) { theory2.Append("<field name=\"%COLUMN_NAME%\" type=\"%DATA_TYPE%\" identity=\"%IDENTITY%\"/>\n"); theory2.Populate(hashtable, "%*%"); theory2.Replace("%IDENTITY%", this.IsIdentity(hashtable)); } theory.Replace("%fields%", theory2); return theory.ToString(); }
protected bool IsIdentity(Hashtable fieldInfo) { bool flag = false; StringTheory theory = new StringTheory("SELECT COLUMNPROPERTY( OBJECT_ID('%TABLE_NAME%'),'%COLUMN_NAME%','IsIdentity') AS IS_IDENTITY"); theory.Populate(fieldInfo, "%*%"); ArrayList results = new ArrayList(); this.process(theory.ToString(), results); if (results.Count > 0) { flag = ((Hashtable)results[0])["IS_IDENTITY"].ToString() == "1"; } return flag; }