public static TableInfo GetTableInfo(string tableName, string cs)
        {
            //  string cs = @"Server=sam-cld-43089-2\DEV;Database=test;Trusted_Connection=True;";

            // string tableName = "t";
            string querycols = @"select column_name as Name,data_type as SQLType from information_schema.columns
             where TABLE_SCHEMA+'.'+table_name = '" + tableName + "' order by ordinal_position";
            string queryPK = @"SELECT column_name as primarykeycolumn
            FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS AS TC
            INNER JOIN
            INFORMATION_SCHEMA.KEY_COLUMN_USAGE AS KU
            ON TC.CONSTRAINT_TYPE = 'PRIMARY KEY' AND
            TC.CONSTRAINT_NAME = KU.CONSTRAINT_NAME
            and ku.TABLE_SCHEMA+'.'+ ku.table_name='"+tableName+"'";

            var db = new SqlDatabase(cs);
            var cols = db.ExecuteSqlStringAccessor<ColumnData>(querycols).ToList();
            var pkName = db.ExecuteScalar(CommandType.Text, queryPK);
            var pkNames = pkName.ToString();
            var ti = new TableInfo();
            ti.PK = cols.Single(x => x.Name == pkNames);
            var usualCols = cols.Where(x => x.Name != pkNames);
            ti.TableName = tableName;
            ti.Columns = new List<ColumnData>(cols);
            ti.UsualColumns = new List<ColumnData>(usualCols);
            return ti;
        }
 public SPGen(TableInfo tableInfo)
 {
     _tableInfo = tableInfo;
 }