Programming Against the Generated Types
Now that you have a better idea regarding the code authored by sqlmetal.exe, consider the follow-
ing implementation of the Program type, which invokes our stored procedure:
class Program
{
const string cnStr =
@"Data Source=(local)\SQLEXPRESS;Initial Catalog=AutoLot;" +
"Integrated Security=True";
static void Main(string[] args)
{
Console.WriteLine("***** More Fun with LINQ to SQL *****\n");
AutoLot carsDB = new AutoLot(cnStr);
InvokeStoredProc(carsDB);
Console.ReadLine();
}
private static void InvokeStoredProc(AutoLot carsDB)
{
int carID = 0;
string petName = "";
Console.Write("Enter ID: ");
carID = int.Parse(Console.ReadLine());
Do'stlaringiz bilan baham: |