by the3factory
4/29/2008 6:24:00 AM
Download code
There are some very nice additions to the new C# 3.0 language. For instance Automatic Properties, Object and Collection Initializers, Extension Methods, Lambda Expressions, Anonymous Types and of course LINQ.
As a developer you probably often write code for accessing data ...
[More]
by the3factory
4/12/2008 9:26:00 AM
Sometime a single table contains many types of entities. For example, imagine a list of contacts-some of them can be customers, others can be suppliers, and others can be company employees. From a data point of view, each entity can have some specific fields. (For example, a customer can have a di...
[More]
by the3factory
4/12/2008 9:24:00 AM
An entity class has two roles. The first is to provide metadata to LINQ queries; for this purpose, an entity class is not instantiated. The second is to provide storage for data read from the relational data source, as well as to track possible updates and support their submission back to the rela...
[More]
by the3factory
4/12/2008 9:15:00 AM
The set of entity classes that LINQ to SQL requires is a thin abstraction layer over the relational model. Each entity class defines an accessible table of data, which can be queried and modified. Entity instances that are modified can apply their changes on data contained in the relational databa...
[More]
by the3factory
4/12/2008 9:12:00 AM
Any external data must be described with appropriate metadata bound to class definitions. Each table must have a corresponding class decorated with particular attributes, which corresponds to a row of data and describes all columns in terms of data members of the defined type. The type can be a co...
[More]
by the3factory
4/12/2008 9:07:00 AM
The first and most obvious application of LINQ is for querying an external relational database. LINQ to SQL is a component of the LINQ Project that provides the capability to query a relational database, offering you an object model based on available entities. In other words, you can define a set...
[More]
by the3factory
4/2/2008 7:14:00 AM
Linq to Sql and Linq more generally speaking, is a new technology mainly based on language evolutions. As any new syntax, you have to take some time to get familiar with it.
The VLinq project as any designer helps you to build graphically Linq to Sql queries but we wanted to keep it visually very c...
[More]
by the3factory
3/25/2008 7:11:00 AM
Extension Methods Resolution
Extension methods resolution is one of the most important concepts to understand if you want to master LINQ. Consider the following code. In it, we define a custom list of type Customer, called Customers, and a class, CustomersEnumerable, that provides an extension me...
[More]
by the3factory
3/25/2008 7:06:00 AM
Deferred Query Evaluation
A LINQ query is not evaluated when it is defined but when it is used. Consider the following query definition:
List<Customer> customersList = new List<Customer>(customers);
var expr =
from c in customersList
where c.Country == Countries.Italy
select...
[More]
by the3factory
3/18/2008 6:07:00 PM
Download code
Introduction
Changing a LINQ expression dynamically (at runtime) depending on the user’s input is one of the problems that are often discussed in forums and blogs. I know at least three solutions proposed by Tomas Petricek (http://tomasp.net/blog/linq-expand.aspx), ...
[More]
by the3factory
3/15/2008 10:27:00 PM
Download code
LINQ to XML sample.
by the3factory
3/15/2008 10:14:00 PM
Download code
LINQ Standard Query Operators sample.
by the3factory
3/15/2008 10:04:00 PM
Download code
LINQ Queries sample.
by the3factory
3/14/2008 11:19:00 AM
Download code
Working with XML using Microsoft’s .NET Framework in version 2.0 and below is a cumbersome task. The API available follows the W3C DOM model and is document-centric. Everything begins with the document; you can’t create elements without having a document, even a ...
[More]
by the3factory
3/13/2008 7:30:00 AM
Average
The Average operator calculates the arithmetic average of a set of values, extracted from a source sequence. Like the previous operators, this function works with the source elements themselves or with values extracted using a selector predicate:
public static Result Average(
this IEn...
[More]