Bilal Haidar [MVP, MCT] Official Blog

Microsoft MVP ASP/ASP.NET, MCP, MCTS, MCPD, MCT
Welcome to Bilal Haidar [MVP, MCT] Official Blog Sign in | Join | Help
in Search

Browse by Tags

All Tags » Linq
  • 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 to Bilal Haidar [MVP, MCT] (Weblog) by BilalHaidar [MVP] on March 18, 2008
  • 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 ... Also, the Body column has AllowNull set to false, so it is a must to always have a value for ...
    Posted to Bilal Haidar [MVP, MCT] (Weblog) by BilalHaidar [MVP] on August 21, 2007
  • 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 user is logged in or not and accordingly show/hide the Image. The code is like ...
    Posted to Bilal Haidar [MVP, MCT] (Weblog) by BilalHaidar [MVP] on August 13, 2007
  • 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 deferred loading in Orcas Beta 2! The new object used is now called ...
    Posted to Bilal Haidar [MVP, MCT] (Weblog) by BilalHaidar [MVP] on August 13, 2007
  • 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 B such that, even if the Customer had no record in the Orders table, I wanted his/record to ...
    Posted to Bilal Haidar [MVP, MCT] (Weblog) by BilalHaidar [MVP] on August 1, 2007
  • 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 to Bilal Haidar [MVP, MCT] (Weblog) by BilalHaidar [MVP] on July 29, 2007
  • 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 of them updates the record and submit changes, then anotehr user comes in and performs another ...
    Posted to Bilal Haidar [MVP, MCT] (Weblog) by BilalHaidar [MVP] on July 28, 2007
  • 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- Without parameters IEnumerable<Customer> results = ...
    Posted to Bilal Haidar [MVP, MCT] (Weblog) by BilalHaidar [MVP] on July 28, 2007
  • 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 on the SqlConnection Product prod = q.Single(p => p.ProductId == 15);if ...
    Posted to Bilal Haidar [MVP, MCT] (Weblog) by BilalHaidar [MVP] on July 28, 2007
  • 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 execute the same query, off course not neceessarily same results. So here the StoredQuery comes ...
    Posted to Bilal Haidar [MVP, MCT] (Weblog) by BilalHaidar [MVP] on July 28, 2007
  • 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 to Bilal Haidar [MVP, MCT] (Weblog) by BilalHaidar [MVP] on July 26, 2007
  • 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 solution is simply using one of the methods defined on the Sequence class: 1. ToArray();2. ...
    Posted to Bilal Haidar [MVP, MCT] (Weblog) by BilalHaidar [MVP] on July 25, 2007
  • 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: var getCustomers= from c in ...
    Posted to Bilal Haidar [MVP, MCT] (Weblog) by BilalHaidar [MVP] on July 25, 2007
Powered by Community Server (Personal Edition), by Telligent Systems