Posts

Showing posts with the label Linq

Filter Records in MVC

Image
In this quick post you will learn various ways to filter records in MVC. Before starting let’s have a quick look at a controller and view page that I will use in this article. I will be using the SQL Server Northwind sample database in this article, you can download it from the Microsoft website and set up the same project to explore it.

Entity Framework Console Applications with SQL Server Compact

Image
Microsoft SQL Server Compact Edition is an embedded database system that allows us to integrate it in our Web, Desktop and Mobile applications.

Entity Framework's Database Seed Method

Image
The Entity Framework can automatically create/update/drop databases when the application runs. We can specify that, this should be done every time application runs or only when the model is out of sync with the existing database or in other word it runs whenever model changes. You spent time to insert records in database and when you made any changes in model, Entity Framework deletes your database as well as records.

Mapping Table-Valued Functions (TVFs) using Entity Framework Database First

Image
Entity Framework 5 brings number of improvements and Mapping Table-Valued Functions (TVFs) Support is one of them.

Spatial Data Type Support in Entity Framework 5

Image
Entity Framework 5 brings number of improvements and Spatial Data Type Support is one of them.

Free ebook: Beginning LINQ

Image
A new fashion to write Queries and address the impedance mismatch between programming languages and database.
This e-book is based on my series of LINQ posts and I’m just consolidating all blog posts here.

Get it Now
PDF Version

Download Size: 1.10 MB Total Pages: 36




Written by Abhimanyu Kumar Vatsa (itorian.com) and Edited By: Deepak K Gupta.

LINQ Query Syntax and Method Syntax - Part 11

This is eleventh part of the ‘LINQ’ series posts that I have started from here. In the last post you learnt how to perform calculations in LINQ query. Now, in this post you will look at some differences between LINQ Query Syntax and Method Syntax used in LINQ.

Performing Calculations in LINQ Query - Part 10

Image
This is tenth part of the ‘LINQ’ series posts that I have started from here. In the last post you learnt how to transform source data/object into XML file and in this post will go ahead and learn how to perform some calculations in LINQ query.

Transforming Data Source objects into XML using LINQ - Part 9

This is ninth part of the ‘LINQ’ series posts that I have started from here. In the last post we explored customizing the LINQ’s ‘select’ statement to select subset of each source element. Now, in this post you will learn how to transform data source objects into XML.

Customizing LINQ’s ‘select’ statement - Part 8

This is eighth part of the ‘LINQ’ series posts that I have started from here. In the last post we explored how to join data from multiple data sources using ‘concat’ key. Now, in this post you will learn how to customize the LINQ’s ‘select’ statement to select subset of each Source Element.


Joining Multiple Data-Sources using 'Concat' Key in LINQ - Part 7

This is seventh part of the ‘LINQ’ series posts that I have started from here. In the last post we explored how to filter, order, group and join in LINQ. Now, in this post we will take a look at concate key used LINQ query to do joins.

Simple demo project on LINQ to SQL using Console Application

Image
In this video post, you will learn how to setup a simple project on LINQ to SQL using Console Application.

LINQ (Language Integrated Query) - Part 6

Image
This is sixth part of the ‘LINQ’ series posts that I have started from here. In the last post we explored selecting records using LINQ and its internals. Now in this post we will be looking at filtering, ordering, grouping and joining using LINQ.

LINQ (Language Integrated Query) - Part 5

Image
This is fifth part of the ‘LINQ’ series posts that I have started from here. In the last post we talked on how to setup a demo project to explore LINQ queries, I expect you too have a demo project with you, if not then visit Part 4 of this series and setup it. Let’s go ahead and explore selecting records using LINQ and explore internals.

LINQ (Language Integrated Query) - Part 4

Image
This is fourth part of the ‘LINQ’ series posts that I have started from here. And in this post, you will learn how to setup a demo project to explore LINQ queries. I will use my preinstalled ‘Northwind’ database that you can download from here and install it in SQL Server Management Studio.


LINQ (Language Integrated Query) - Part 3

Image
This is third part of the ‘LINQ’ series posts that I have started from here. And in this post, you will learn something on ‘Generic’ like what are generic types, why we need it in LINQ?


LINQ (Language Integrated Query) - Part 2

Image
This is second part of the ‘LINQ’ series posts that I have started from here. And in this post, you will see some quick examples on LINQ title.

As I said in previous post, with LINQ you just need to perform three distinct actions: Obtain the Data Source, Create the query and Execute the query, you will notice it in sample programs given below. We will create Console Apps and test various LINQ concepts. I will walk through very simple programs here and in coming part will dig in depth.

LINQ (Language Integrated Query) - Part 1

Recently I had started exploring ‘LINQ to Entities’ new features. So, I thought to start a series of posts on ‘LINQ’ title and accumulate it on my blog for the beginner’s.

Hope, this series will be helpful to you to understand the ‘LINQ’ and before jump start to the application development let’s talk on basics something like: what is linq and its benefits.

Query Expression vs Dot Notation in LINQ (a concise talk)

Introduction
We can see there are two or more ways to achieve the same results in LINQ that is by using dot notation and query expression.
Look at the sample examples.
Query Expression Example
var results = from product in products orderby product.Price descending selectnew                 {                     product.Name,                     product.Price                 }; int count = 0; // print out the names foreach (var p in results) { Console.WriteLine("Item: {0}, Cost: {1}", p.Name, p.Price); if (++count == 3)     { break;     } }

Dot Notation Example
var results = products                         .OrderByDescending(e => e.Price)                         .Take(3)                         .Select(e => new { e.Name, e.Price }); foreach (var p in results) { Console.WriteLine("Item: {0}, Cost: {1}", p.Name, p.Price); }

The idea is that there are two ways to express the sa…

What is LINQ? Learn it by solving problems.

Introduction
LINQ (Language INtegrated Query) fills the gap between programming languages and database.
According to Anders Hejlsberg (C# Chief Architect):-
“Microsoft’s original motivation behind LINQ was to address the impedance mismatch between programming languages and database.”
If we compare LINQ to SQL, LINQ is simpler, tidier and very handy to use. It’s rather like comparing C# to C/C++ Programming, the time is gone when C/C++ was best but now coder needs something special like LINQ and it’s a big win. SQL is a very old language that was invented about 1974. Since then it's been extended endlessly, but never redesigned. This has made the language messy. You might have become so accustomed to this that you can't see anything wrong.
I think my above lines will increase your concrete knowledge about Microsoft LINQ, so let’s look at some problems and we will solve this u…

Popular posts from this blog

5 Ways to send data between ASP.NET Pages