... example.
Reprinted Here for Convenience Is Listing 1 -3
using System;
using System .Linq;
using System.Data .Linq;
using nwind;
Northwind db = new Northwind(@"Data Source=.\SQLEXPRESS;Initial Catalog=Northwind");
var ... Equals(string x, string y)
{
return(Int32.Parse(x) == Int32.Parse(y));
}
public int GetHashCode(string obj)
{
return Int32.Parse(obj).ToString().GetHashCod...
... Service-Oriented
Architecture, 3e
Beginning ASP.NET 3. 5
Data Access, 2e
Beginning
C# 2008 Databases
Beginning C# 2008
Pro LINQ: Language
Integrated Query
in C# 2008
www .apress. com
SOURCE CODE ONLINE
Companion ... ROADMAP
Silverlight and .NET 3. 5
Recipes in C# 2008
Pro C# 2008 and the
.NET 3. 5 Platform
Pro WPF in C# 2008, 2e
Illustrated C# 2...
... into the entity classes at key
points in time.
Finally, query expressions provide that warm fuzzy feeling when first seeing a LINQ query that
makes you want to get on board with LINQ. Nothing ... next.
Listing 3- 4. An Example Demonstrating the Query Results Changing Between Enumerations
// Create an array of ints.
int[] intArray = new int[] { 1,2 ,3 };
IEnumerable<int> i...
... understanding of LINQ to Objects and just what LINQ can
do for you, it’s time to learn about using LINQ to query and generate XML. This functionality is called
LINQ to XML and, not so coincidentally, ... the same prototype but, this time, with elements in the input sequence, as shown
in Listing 5 -38 .
Listing 5 -38 . First Any Prototype Where Elements Are in the Source Input...
... Tuesday, October 23, 2007 4 :37 PM
252
CHAPTER 7
■ THE LINQ TO XML API
XProcessingInstruction.Target on XProcessingInstruction Objects and
XProcessingInstruction.Data on XProcessingInstruction Objects
To ... value of a processing instruction, simply modify the Target and Data properties of the
XProcessingInstruction object. Listing 7-72 is an example.
Listing 7-72. Updating a Processing...
... make it interesting, I will query on the type attribute, and I will try
this one in query expression syntax, as shown in Listing 9 -3.
Listing 9 -3. Obtaining Restricted Elements Without Reaching ... " ;Pro LINQ: Language Integrated Query in C# 2008& quot;)),
new XElement("BookParticipant",
new XElement("Name", "John Q. Public"))};
R...
... same value, as shown in Listing 10-7.
Listing 10-7. Comparing 3 to 3
Console.WriteLine(" (3 == 3) is {0}.", (3 == 3) );
The following is the result of this code:
(3 == 3) is True.
There ... do?
The LINQ to DataSet operators allow a developer to perform LINQ queries on a DataSet, and
since a DataSet can be obtained using normal ADO.NET SQL queries, LINQ to DataSet...
... ready to
insert Customer records using the InsertCustomer stored procedure. In Listing 13- 3, I will create a
new customer using the InsertCustomer stored procedure.
Listing 13- 3. Creating a Customer ... 2007 1:27 PM
38 8
CHAPTER 12
■ LINQ TO SQL INTRODUCTION
Using the LINQ to SQL API
In order to use the LINQ to SQL API, you will need to add the System.Data .Linq. dll assembly...
... to the query for the respective column. Listing 14-16 contains an example programmati-
cally building a query for such an interface.
Listing 14-16. Programmatically Building a Query
Northwind db ... let’s examine an InheritanceMapping attribute:
An InheritanceMapping Attribute
[InheritanceMapping(Code = "G", Type = typeof(Shape), IsDefault = true)]
The preceding InheritanceMap...
... mapping file to perform
a LINQ to SQL query without using any attributes.
Listing 16-9. The Third DataContext Constructor Prototype Connecting to a Database and Using a
Mapping File
string ... Source=.\SQLEXPRESS;Initial Catalog=Northwind ;Integrated Security=SSPI;",
nwindMap);
IQueryable<Linqdev.Customer> query =
from cust in db.GetTable<Linqdev.Customer>()
wh...