SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 363 | Next

Scott Klein

"Professional LINQ"

Creating a class that inherits from the DataContext class provides youwith
all the connection processing functionality you need to work with LINQ to SQL and communicate
with SQL Server.
228
Chapter 11: LINQ to SQL Queries
Add a class called AdventureWorks that inherits from the DataContext class. Within that class, add the
highlighted code shown below:
namespace LINQ
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
}
}
public class AdventureWorks : DataContext
{
public AdventureWorks(string connection) : base(connection) {}
}
}
Next, create a method and map it to the stored procedure created earlier. Underneath the DataContext
connection, add this highlighted code:
public class AdventureWorks : DataContext
{
public AdventureWorks(string connection) : base(connection) {}
[StoredProcedure(Name = "OrdersBySalesPersonID")]
public IEnumerable SalesOrders
([Parameter(DBType="int")] int salesPersonID)
{
return this.


Pages:
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6