Welcome to Bilal Haidar [MVP, MCT] Official Blog Sign in | Join | Help

Browse by Tags

All Tags » Linq   (RSS)

LINQ Framework Design Guidelines

There is a very good resource on LINQ design guidelines that you can read more on it here: LINQ Framework Design Guidelines ( http://blogs.msdn.com/mirceat/archive/2008/03/13/linq-framework-design-guidelines.aspx ) Hope it helps, Regards
Posted by BilalHaidar [MVP] | 0 Comments
Filed under: , ,

LINQ To SQL and Allow Null in SQL Server 2005

I figured out tonight something new in LINQ To SQL related to updating records in the database and here it is: Suppose you have a table in SQL Server 2005, that stores data related to Article. Each article has the ArticleID, Body, Abstract, title, etc
Posted by BilalHaidar [MVP] | 0 Comments
Filed under: ,

Extension Methods in C# 3.0 and ASP.NET Code-Inline

I was customizing a ListView today to show a small key gif beside each article listed to indicate that the article requires a login to be viewed based on whether the user is authenticated or not. So I decided to use inline checking to see if the current
Posted by BilalHaidar [MVP] | 0 Comments
Filed under: ,

Deferred Loading in DLinq - Orcas Beta 2

In a previous post of mine (Deferred Loading in DLinq - http://bhaidar.net/cs/archive/2007/07/26/deferred-loading-in-dlinq.aspx ), I explained to you how deferred loading works in DLinq. There have been some changes to the object used to enable/disable
Posted by BilalHaidar [MVP] | 1 Comments
Filed under: ,

LEFT OUTER JOIN in LINQ To SQL

I was practicing a little bit on using Linq to Sql, and had this scenario: Customers and Orders tables in Northwind Database. I added a new customer with no records, I wanted to apply a left outer join to get customers whose CustomerID starts with letter
Posted by BilalHaidar [MVP] | 4 Comments
Filed under: , ,

www.Hookedonlinq.com

I would like to invite you to check this wonderful website dedicated to LINQ (XML, Objects, database, Dataset, etc ...) www.hookedonlinq.com Make sure you visit it! Regards
Posted by BilalHaidar [MVP] | 0 Comments
Filed under: ,

Optimistic Concurrency in DLinq

Dlinq handles optimistic concurrency implicitly when exexuting SubmitChanges() method. However, you can handle the resolution of the conflict and deciding on how to solve a conflict that happened. Usually, when two users retrieve the same record, one
Posted by BilalHaidar [MVP] | 0 Comments
Filed under: ,

Direct SQL Execution in DLinq

A very nice feature I find is to be able to execute a custom SQL statement in case you find the functionalities provided by the DataContext object is limited. There are two main methods: ExecuteQuery, which has two flavors of the ExecuteQuery method 1-
Posted by BilalHaidar [MVP] | 0 Comments
Filed under: ,

Transactions in DLinq

There are two ways in DLinq to work with Transactions. One is preferred to another. 1. Using the TransactionScope class - Preferred One using(TransactionScope ts = new TransactionScope()) { db.SubmitChanges(); ts.Complete(); } 2. Using the BeginTransaction
Posted by BilalHaidar [MVP] | 0 Comments
Filed under: ,

Compiled Queries in dLinq

In an API I use in my applications at work, we have the notion of StoredQuery. We prepare a query against the database, store it as a StoredQuery, then execute the query. Why do we need to save the query expression? Maybe at some other time, we need to
Posted by BilalHaidar [MVP] | 1 Comments
Filed under: ,

Apply Method Filtering on Projection Results

Applying method filtering on the results of a DLinq query is not available. For example, suppose you want to run method named Validate on the Customer ID before returning it in the query: var result= from c in db.customers select new {CustomerName= c.Name,
Posted by BilalHaidar [MVP] | 0 Comments
Filed under: ,

Is Deferred Execution always required and needed

In the previous post, I have explained the idea behind Deferred Execution. What if you wanted to directly execute the query expression and bind the results to a GridView or any other Data Control? In this case, Deferred Execution is not required. The
Posted by BilalHaidar [MVP] | 0 Comments
Filed under: ,

Deffered Execution in DLinq

I have started recently working on C# 3.0 Enhancements and LINQ project at the same time. One of the nice features of LINQ is the ability to write Query Expressions. You can think of Query Expressions as a high-level SQL Query. You write a query as follows:
Posted by BilalHaidar [MVP] | 0 Comments
Filed under: ,