Saturday 1 February 2014

LINQ Fundamentals - Part 1



Introduction To LINQ


Language Integrated Query (LINQ, pronounced "link") is a Microsoft .NET Framework component that adds native data querying capabilities to .NET languagesLINQ extends the language by the addition of query expressions, which are akin to SQL statements, and can be used to conveniently extract and process data from arrays, enumerable classes, XML documents, relational databases, and third-party data sources.

image




image




image



image



image




image




Standard Query Operators


image




image



image



image




Query Expressions



image





LINQ Extensibility



image




LINQ To Objects


image




image



image




image




Demo of Deferred Execution


image



image






LINQ To XML



image



image




Demo of Functional Construction via LINQ


image




image



image




Querying XML document


image




image




image





LINQ to SQL


image




Mapping objects to Tables

image




image



image



Demo of LINQ to SQL


image


image




image



image






Entity Framework


image


Note:
You may think that what is the difference between Entity Framework and LINQ to SQL which does that same thing. There are some differences between Entity Framework and L2S.
  • Entity framework has a full provider model. It supports not only SQL Server but also other database like Oracle, DB2, MySQL etc.
  • Most of the time L2S classes must be one-to-one with database objects e.g. Customer class can be mapped only with Customer table. Where as in Entity Framework you can map your domain class with multiple tables using various inheritance strategies like table per type (class) or table per hierarchy of classes etc.
  • You can have multiple modeling techniques using Entity Framework 4.1 like code first, model first or database first.



image





LINQ and C#


image



image



image




image




image



image




image



image




image





Operators as Extension methods in LINQ


image




image





Functional programming with Lambdas


image



Named function as a parameter

image



Anonymous Method as parameter

image




Lambda expression as a parameter

image




image




Lambda Expression Essentials


image




Constructing Lambda Expressions


image




Invoking Lambda Expressions



image



image




Expressions


image




image




image




image


Note:  To execute Expressions, it should compile first and needs to be executed.



Expression Trees


image


image




Remoting LINQ


image



image



image





Query Expressions


image




image




image



image




Type inference


image



image




image




Anonymous Types


image



image




Initializers for Classes and Collections


image





Partial Methods



image



image



image





LINQ Queries


image




image



image


image



Query Expressions

image




Lambda Expression

image



image




Wrong WHERE Implementation
image




Right Custom WHERE Implementation

image


image




Deferred Execution Surprises



image



image



Greedy Operator in LINQ



image



image





The LET and INTO Keywords


image



image



image





Grouping in LINQ


image



image


image



image



image




Grouping and Projecting


image



image



image



image



image



image




Nested Queries


image




Correlated Sub-queries

image




image




image







Group Joins


Join with INTO keyword will make Grouping into Join result set.
image


image




image




Sorting

image




Composition


image




image




image



image




image



image



LINQ Pad Application usage


image


image



image




Standard LINQ Operators


image



image



Filtering


image



image



Sorting

image




image




Set Operators


image



Distinct

Equality in LINQ to Objects

image




Quantifiers

image



image




Projection Operators


image



image





Partitioning


image




Joining

image



image



image



image



image




Grouping

image




image




image



Lookups


image



image




Generation Operations


image



image





Equality

image




Element Operators in LINQ

image




Conversions


image



image



image




image




image



image




image


image



Blogger Labels: LINQ,Fundamentals,Introduction,Language,Query,Microsoft,Framework,component,data,capabilities,languages,addition,statements,databases,Standard,Operators,Expressions,Objects,Demo,Execution,Functional,Construction,Tables,Note,difference,differences,provider,Server,database,Oracle,MySQL,Most,Customer,Where,domain,inheritance,strategies,hierarchy,techniques,Extension,Lambdas,parameter,Anonymous,Method,Lambda,Expression,Essentials,Trees,Type,inference,Types,Initializers,Classes,Collections,Partial,Methods,Queries,Wrong,Implementation,Custom,Surprises,Greedy,Operator,INTO,Keywords,Group,Joins,Join,Composition,Application,usage,Distinct,Quantifiers,Projection,Lookups,Generation,Operations,Element,Conversions

1 comment: