Sub query in LINQ to Entities

Entity Model Name  : TestLinqDataContext db = new TestLinqDataContext();   var innerQuery = (from fb in db. TagMasters orderby fb.ExpirationDate descending select fb.ExpirationDate).Take(3).Distinct(); var result = (from f in db.TagMasters…

Calling an stored procedure using ADO.NET Entity Model (Entity Framework LINQ to SQL)

In this article I would like to share something regarding Entity Framework, how we can implement operations using Stored Procedures in Entity Framework. SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[Users]( [Uid] [int] IDENTITY(1,1) NOT NULL, [Fname] [nvarchar](50) NULL, [Lname] [nvarchar](50) NULL, [Email] [nvarchar](50) NULL, [Gender] [nvarchar](50) NULL, [Address] [nvarchar](50) NULL, CONSTRAINT [PK_Users] PRIMARY KEY CLUSTERED ( [Uid] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO SET ANSI_NULLS ON GO

Introduction to LINQ

Language Integrated Query (LINQ) provides .NET developers some new and exciting features to query and manipulate data in a consistent and uniform way. It enables them to work with different type of data sources such as Arrays, collection of objects, XML documents, a relational databases, Active Directory or even Microsoft Excel sheets by writing or embedding queries in C# or Visual Basic language. Microsoft has introduced many new keywords and features in both C# and Visual Basic languages to integrate LINQ technology. Microsoft has also added new namespaces in .NET Framework Library that contains new interfaces and hundreds of extension methods also called LINQ query operators. These methods perform different operations on different type of data sources in LINQ. LINQ stands for Language-Integrated Query. Basically LINQ address the current database development model in the context of Object Oriented Programming Model. If some one wants to develop database application on .Net platform the very simple approach he uses ADO.Net. ADO.Net is serving as middle ware in application and provides complete object oriented wrapper around the database SQL.So developer must have good knowledge of object oriented concept as well as SQL to develop an application. But incase of Linq SQL statements are become part of the C# and VB.Net code so there are less chance of mistake.