Menu

Entity Framework

How to return the ID field after the insert in Entity Framework ?

There are times when you want to retrieve the ID of the last inserted record when using Entity Framework . For example ,
Employee emp = new Employee();

emp.ID = -1;

emp.Name = "Senthil Kumar B";

emp.Expertise = "ASP.NET MVC"

EmployeeContext context = new EmployeeContext();

context.AddObject(emp);

context.SaveChanges();
In the above example , if i need to retrieve the Read More →

How to return Dictionary as result from a LINQ Query in C# ?

This article will provide a code snippet and explains how to return Dictionary as result from a LINQ Query in C#. There are times when you want to retrieve only the ID(distinct) and the name from the database table using LINQ . In scenarios like this , one can use the Read More →

LINQ Insight 2.0 now supports RavenDB

Recently , Devart released the LINQ Insight 2.0 with the support for RavenDB and other new features .

What is LINQ Insight ?

LINQ Insight is a Visual Studio add-in which allows the execution of the LINQ queries at design time . Some of the features of LINQ Insight 2.0 includes

Difference between Any() and Count() in LINQ

Most of the developers would have come across Any() and Count() when using LINQ in C# . What is difference between Any() and Count() in LINQ ?

Difference between Any() and Count() in LINQ

Assume , you want to know if the collection contains records based on some criteria and you Read More →

Using Lambda Expression and LINQ to Concatenate strings in C#

Learnt something cool today on how to use Lambda expression and LINQ to concatenate string in C#.

Using Lambda Expression and LINQ to Concatenate strings in C#

There are couple of ways which I explored using today for concatenating string using LINQ . It includes the usage of the Select function but Read More →

How to Delete all data from the table (Truncate) in Entity Framework ?

If you want to Truncate Data or delete all the data from the table in Entity Framework (.NET 4.5) , you can use the ExecuteSqlCommand defined in the DBContext.Database class .

How to Delete all data from the table(Truncate) in Entity Framework ?

Below is a sample source to demonstrate how to Read More →

Linqer – SQL to LINQ Converter tool

If you are looking for a SQL to LINQ tool that can convert the SQL Syntax to LINQ , you are at the right place . In this blog post , we share a tool that helps the developers for converting the SQL syntax to LINQ .

Linqer - SQL to Read More →

Selecting the ORM for developing ASP.NET Application

For last few years , I had the opportunity to try LINQ to SQL and Entity Framework and have been using Entity Framework successfully in couple of mny projects. It's not only LINQ to SQL or Entity Framework but there are various others ORMs available for the developers .

Using MySQL with Entity Framework in .NET Application.

Are you looking for the support of MySQL with Entity Framework for developing a .NET Application using the MySQL database ? . If Yes , you can use the MySQL connector for .NET v6.6 which is available for download from MySQL downloads page. The MySQL connector for .NET v6.6 Read More →

SingleOrDefault vs. FirstOrDefault in LINQ

The LINQ (Language Integrated Query) has the extension methods SingleOrDefault and FirstOrDefault . What is the difference between SingleOrDefault and FirstOrDefault in LINQ. In one of my previous blog post , I wrote about .First() throws Error in LINQ or Entity Framework Queries which explains the use of Read More →

LINQ tutorials and Resource Links

Want to learn LINQ(Language Integrated Query) in .NET ? In this blog post , I will share links to some LINQ tutorials that the developers find interesting and useful to get started with.

What is LINQ ?

LINQ stands for Language Integrated Query . Read More →

Using the operator AND in LINQ

Recently , I had received an query from one of my blog readers asking the question related to SQL and LINQ .
"In SQL , we can use AND operator when checking for multiple conditions , what is the equivalent of AND in LINQ in c#" ?
This is a simple one Read More →

LIKE operator in LINQ

Does the LINQ(Language Integrated Query) have the LIKE operator like the one we have in the SQL Server or any other databases ? I have been searching for similar function in LINQ and below are some of the ways which you could bring in the functionality of the LIKE operator in Read More →

What is the difference between IEnumerable and IQueryable in C# ?

If you are a C# developer and work with collections as well as LINQ/Entity Framework , you would have come across these 2 interfaces
  • IEnumerable
  • IQueryable

What is the difference between IEnumerable and IQueryable in C# ?

1. IEnumerable is used mostly for working with in-memory collection data where as IQueryable suits Read More →

Review – 70-516 Exam Accessing Data with Microsoft .NET Framework 4 Preparation Kit from uCertify

Few weeks back, I had received an offer from uCertify to review their Exam Preparation Kit for the Microsoft Certification exam MCTS - 70-516 Accessing Data with Microsoft .NET Framework 4. In one of my previous blog post, I shared the first look Read More →

Reviewing Exam- 70-516 Accessing Data with Microsoft .NET Framework 4 PrepKit from uCertify

I have got a offer from uCertify to review their PrepKit and I have accepted that challenge and now I am reviewing  70-516-CSHARP: TS: Accessing Data with Microsoft .NET Framework 4 PrepKit from uCertify. Initially it looks very simple and easy to use and learn . As Read More →

Entity Framework 4.3.0 Beta 1 Released

Microsoft's ADO.NET Team announces the release of Entity Framework 4.3.0 Beta 1 which includes a number of bug fixes for DbContext API and Code First . The current release is also about integrating migrations in to the Entity Framework Nuget package . Microsoft's ADO.NET Read More →

Using Aggregate Function on Arrays in C#

If you have got an array of integers and you want to multiple the values inside the array and display its value without using for loop  , here's one of the ways to achieve it using the LINQ and Lambda expression . Assuming the array of integer Read More →

How to order by multiple columns using Lambas and LINQ in C# ?

Today , i was required to order a list of records based on a Name and then ID . A simple one but i did spend some time on how to do it with Lambda Expression in C# . C# provides the OrderBy,OrderByDescending,ThenBy,ThenByDescending . You can use them in your lambda expression to Read More →

LINQ Equivalent of SQL’s “IN” keyword

I came across the requirement to use the "IN" equivalent of LINQ when using Entity Framework . I am sure most of the .NET Developers would also have come across a situation to use "IN" in LINQ . Here's an example  . The SQL Query looks like this
SELECT * FROM MOVIES Read More →           
Back to top

© 2011-2013 Senthil Kumar's Blog This is my personal blog .The opinions expressed here represent my own and not those of my employer . All Rights Reserved -- Copyright notice by Blog Copyright