Sunday, November 18, 2007

Sample Vote Of Thanks Speech At A Edding



I've just created an article on the language extensions of C # 3.0.
language extensions in C # 3.0

Tuesday, November 6, 2007

How To Congratulate Sims 3

LINQ to SQL (Part 1)

LINQ to SQL is an O / R Mapper, which comes along with that. NET Framework 3.5. LINQ to SQL allows you to model relational data as. NET classes. The data can be read and be manipulated as well. In this case, LINQ to SQL transactions, views, stored procedures and UDFs.

Visual Studio 2008 has a designer to model the data.



The DataContext class does the actual work. This class encapsulates access to the database.

Code examples in C #:
The following example, all customers back from London.
 
using (NorthWind DataContext ctx = new NorthwindDataContext ())
{
var customers = from c in ctx.Customers
where c.City == "London"
select c;}


A customer edit and save.
 
using (NorthwindDataContext ctx = new NorthwindDataContext ()) {

Customer customer =
ctx.Customers.Single ( c => c.CustomerID == ALFKI );
customer.City = "New City" ;
ctx.SubmitChanges ();} Add


to a customer order.
 
using (NorthwindDataContext ctx = new NorthwindDataContext ()) {

Customer customer =
ctx.Customers.Single (c => c.CustomerID == ALFKI );
Order order = new Order

{OrderDate = DateTime.Now,
ShipCountry = "Berlin",
ShippedDate = DateTime.Now.AddMonths (2)
};
customer.Orders.Add ( order);
ctx.SubmitChanges ();} delete


an order.
 
using (NorthwindDataContext ctx = new NorthwindDataContext ()) {

Order order =
ctx.Orders.Single (o => o.OrderID == 11080);
ctx.Orders.Remove (order) ;
ctx.SubmitChanges ();}