Exemplo n.º 1
0
        public int Generate(string nameSpace, string sa, string password)
        {
            string SQL = @"
            USE [{0}]
            SELECT name, OBJECT_DEFINITION(OBJECT_ID) AS sp
            FROM sys.procedures
            WHERE is_ms_shipped <> 1
            ORDER BY name
            ";

            SqlCmd cmd = new SqlCmd(databaseName.Provider, string.Format(SQL, databaseName.Name));
            // cmd.ChangeConnection(sa, password);
            DataTable dt = cmd.FillDataTable();


            foreach (DataRow row in dt.Rows)
            {
                SpProc proc = new SpProc(databaseName, (string)row[SP_NAME], row[SP_DEFINITION].IsNull <string>(""));

                string sourceCode = proc.Proc(nameSpace, databaseName.Name, sa, password);
                WriteFile(proc.SpName, sourceCode, nameSpace, proc.IsSpChanged(nameSpace, databaseName.Name));
            }

            return(dt.Rows.Count);
        }
Exemplo n.º 2
0
        public int Generate(string nameSpace, string sa, string password)
        {
            string SQL = @"
            USE [{0}]
            SELECT name, OBJECT_DEFINITION(OBJECT_ID) AS sp
            FROM sys.procedures
            WHERE is_ms_shipped <> 1
            ORDER BY name
            ";

            SqlCmd cmd = new SqlCmd(databaseName.Provider, string.Format(SQL, databaseName.Name));
               // cmd.ChangeConnection(sa, password);
            DataTable dt = cmd.FillDataTable();

            foreach (DataRow row in dt.Rows)
            {
                SpProc proc = new SpProc(databaseName, (string)row[SP_NAME], row[SP_DEFINITION].IsNull<string>(""));

                string sourceCode = proc.Proc(nameSpace, databaseName.Name, sa, password);
                WriteFile(proc.SpName, sourceCode, nameSpace, proc.IsSpChanged(nameSpace, databaseName.Name));
            }

            return dt.Rows.Count;
        }