EF query execution pattern. Usage of sp_executesql vs direct execution of sql statement

This was posted in an internal discussion. The question was that it was observed that sometimes in the generated sql it appeared that EF was very decisive between directly executing the query and sometimes using sp_executesql. Before I go ahead and explain this behavior a little background on sp_executesql. The sp_executesql comes into play when…

0

ObjectSet<T> vs ObjectQuery<T> in Entity Framework v 4

I was a little curious about this change in EFv4 and wanted to understand why this was done. So here is what I was able to understand Background Lets take a look at the following code for querying the EntitySet in EF v3.5 using (NorthwindEntities ex = new NorthwindEntities()) { var cus = ex.Customers; foreach…

0

Referring ADO.Net Entity project in a different project

QuickPost: I just now answered a question on the forum about one of the errors that might take you a while to figure out. Assume the following scenario, you have a Data Model Project designed as class library for EntityFramework and you have a middle layer or a UI Layer and you are referring the…

0

Using EntityBag with EntityFramework over WCF

I was going through the article published in MSDN by Daniel Simmons about the N-Tier Patterns http://msdn.microsoft.com/en-us/magazine/dd882522.aspx and came across the EntityBag implementation. So I went through couple of posts by Daniel on the EntityBag stuff to acquire the working knowledge and get started with EntityBag.  The project is hosted in codeplex There were a…

1

Using Stored Procedures That Return Non Entity Type

In  the previous post I explained how to use a Stored Procedure in Entity Framework that returns an Entity Type.  However, if you try to map a stored procedure that is of a scalar type or returns an Array or List type then this won’t work automatically with the current release of Entity Framework. In…

1

Using Stored Procedures in Entity Framework

Entity framework supports stored procedure. In this post I will explore how we can use stored procedures in entity framework. I have created a Windows based application with Northwind database model(EDMX) . And have the Customer and Orders table selected.   In order to add a stored procedure open up the Model Browser and right…

5

Getting Started With EntityClient in EntityFramework

In this post I am going to illustrate how to use EdmGen and EntityClient to program with Entity Framework. EdmGen is utility shipped with Entity Framework for creation of the artifacts required for Entity Model Mapping viz the CSDL(Conceptual Schema Definition Language), SSDL(Storage Model) and MSL(Mapping Model). Though you can use the EDM wizard in…

1