Posts

Showing posts from March, 2008

Important and advanced concepts in SQL Server 2005

Introduction This article discusses some of the most important and advanced concepts in SQL Server and how one can improve the performance of SQL Server using the best practices. CLR integration Any code that runs under the Common Language Runtime (CLR) hood is managed code. The CLR is the core of the .NET environment providing all necessary services for the execution of the managed code. SQL Server 2005 has a tight integration with the CLR which enables the developer to create stored procedures, triggers, user defined functions, aggregates and user defined types using the managed code. T-SQL suits best when you need to perform little procedural logic and access data from the server. If your data needs to undergo complex logic then the better option is using managed code. When working on data intensive operations, working in T-SQL would be an easy approach, but T-SQL lacks the ease of programming. You might end up in lot of lines of coding in trying to simulate operations that are spec
Introduction Object Pooling is nothing new. It is a concept that implies that we can store a pool of objects in memory to be reused later and, hence, reduce the load of object creation to a great extent. An Object Pool, also known as a Resource Pool, is a list/set of ready to be used reusable objects that reduce the overhead of creating each object from the scratch whenever a request for an object creation comes in. This is somewhat similar to the functioning of a Connection Pool, but with some distinct differences. This article throws light on this concept (Object Pooling) and discusses how we can implement a simple generic Object Pool in .NET. What is an Object Pool? An Object Pool may be defined as a container of objects that are ready for use. Lists of ready-to-be-used objects are contained in this pool. Whenever a new request for an object creation comes in, the request is served by allocating an object from the pool. Therefore, it reduces the overhead of creating and re-creating

LINQ sample from C#.NET 3.0

LINQ to Objects allows you to use LINQ queries with any object that support IEnumerable or IEnumerable(T). This means that you can use LINQ to acccess data in arrays, lists, dictionaries, and other collections. You also can use LINQ with any of your own classes that implement or inherit IEnumerable. Let me start with a very simple introduction using an array of integers. This following example uses LINQ to find all of the even integers in an array of integers: // Array of data int[] Data = { 17, 32, 51, 98, 87, 4, 63, 26, 75, 40 }; // Create the variable to store the query var EvenNumbers = from Num in Data where Num % 2 == 0 select Num; // Run the query and output the results foreach (int i in EvenNumbers) Debug.Print(i.ToString()); Data is simply an integer array. The only thing important about it is that arrays implement IEnumerable so LINQ can be used with them. The statement of interest in this example is the definition of EvenNumbers. The from clause is used to define a subse