LINQ to SQL Tips 6: How to refresh given DataContext won’t stomp on your objects

The DataContext is a rather careful beast. Once an object is retrieved, the DataContext will not stomp on it if a query returns the same object again. This is intentional. Imagine the chaos if you modified some of the retrieved objects or even read the values and made some decision based on that and then…

5

LINQ to SQL Tips 5: Using stored procs that return multiple results

Often I get the following questions about stored procs in LINQ to SQL: I have sproc that returns multiple results. How can I use it in LINQ to SQL? Can I use a sproc that returns results of different shapes; e.g. Customers and Orders? I drag-dropped a sproc returning multiple results on the designer surface….

7

LINQ to SQL Tips 4: Use DeleteOnNull if you want to delete object with null FK

I often get a question along the following lines: If I remove one of the OderDetails from Order.OrderDetails collection, I see that the reference OrderDetail.Order is set to null but this just orphans the OrderDetail; it is not deleted. How can I change that? Here is how: This is not exposed in the designer so…

5

From LINQ team to App Framework on Silverlight team

A while ago (October last year), I moved from C# team to the “UI Frameworks” team inside the .NET Developer Platform team. C# team is where LINQ was incubated and large portions of LINQ were productized: LINQ to Objects, LINQ to SQL and C# 3.0 to be precise. So it was with mixed emotions that…