Example #1
0
        public override string CreateText(AppObject appobj, ConnectionPack connpack)
        {
            ObjectPath          objpath = appobj.GetObjectPath();
            IDatabaseSource     db      = appobj.FindDatabaseConnection(connpack);
            IPhysicalConnection conn    = appobj.FindPhysicalConnection(connpack);
            ITableSource        tbl     = appobj.FindTableConnection(connpack);

            if (conn != null && objpath != null)
            {
                string text = conn.InvokeR <string>((Func <string>) delegate()
                {
                    if (conn.SystemConnection != null)
                    {
                        conn.SystemConnection.SafeChangeDatabase(objpath);
                    }
                    var sw  = new StringWriter();
                    var gen = new GenSql_CreateTable();
                    gen.GenerateCreateTable(tbl, sw, conn.GetAnyDialect());
                    return(sw.ToString());
                });
                return(text);
            }
            return("");
        }