Problem moving code from LINQPad to VS project

I'm having a bit of a problem.

I have a LINQPad C# script that does this:

var allProcs = (from routine in theDatabaseContext.INFORMATION_SCHEMA.ROUTINES
where routine.ROUTINE_TYPE == "PROCEDURE" ||
routine.ROUTINE_TYPE == "FUNCTION"
select new {
Name = routine.ROUTINE_NAME.ToUpper(),
Type = "Proc/Func",
Text = routine.ROUTINE_DEFINITION.ToUpper()
}).ToList();

Works great in LINQPad. But getting this into a VS project is problematic. You can't add INFORMATION_SCHEMA to a DBML designer in Visual Studio. I've seen workarounds on the web where people create temporary tables that are basically dumps of what's in this view, but I do not have the appropriate rights to modify schema/create tables. But obviously LINQPad is capable of generating a good db context to the system view here. How can I get the functionality above into my VS script without re-writing my script (there are other queries similar to this in the script).

Thanks,
Randy

Comments

Sign In or Register to comment.