Entity Framework Beta 3 Is Available for Download

Entity Framework Beta 3 and related packages are available for public download: ·         Entity Framework Runtime:         http://go.microsoft.com/fwlink/?LinkId=104981 ·         Entity Framework Tools:                 http://go.microsoft.com/fwlink/?LinkId=104983 ·         Entity Framework Samples:            http://go.microsoft.com/fwlink/?LinkID=104849 ·         Entity Framework Documentation: http://go.microsoft.com/fwlink/?LinkID=104984  

5

Entity SQL: Canonical Functions

Canonical functions were introduced in the Beta 2 release of Entity Framework. Their purpose is to expose a [virtually] canonical API beyond the core language constructs. Consumers of canonical functions should be aware that Entity Framework defines only the “syntax” part of the API. The behavior is entirely up to the store provider. Not the…

7

Definition: API

API = syntax + behavior

3

What Do ObjectQuery’s Builder Methods Build

Until Beta 2 ObjectQuery’s builder methods used to build a Command Tree. There were multiple problems with that: ·         Duplicate code – there is already a component that builds Command Trees from Entity SQL. ·         Caching – Command Trees are expensive to hash and thus – difficult to cache. ·         Tracing – getting a meaningful…


How to Get the Native SQL from an ObjectQuery

The way to get the native SQL generated for an ObjectQuery is exactly the same as for EntityCommand – using the new ToTraceString() method introduced in Beta 3. Previously that would require a similar (even more obscure) pattern that involved ObjectQuery.CreateCommandTree() and IServiceProvider.CreateCommandDefinition(). Now that there is a new pattern, both of the above methods…

3

How to Get the Native SQL from an EntityCommand

With the Beta 3 release, Entity Framework is introducing an easy way to get the native SQL from an EntityCommand. There was public API to get to the native SQL, but the pattern was too obscure, and I don’t want to go into detail. Let’s discuss the new one, instead. It’s a single method directly…

4

How to Do Custom Mapping Using Entity SQL Views

This post was intended to be a reply to this question http://forums.microsoft.com/msdn/showpost.aspx?postid=2440161&siteid=1 on the Entity Framework forum, but its size exceeds the forum server limit. Besides, it’s useful in general. So I decided to post it here. In this post you’ll find an entire repro of the subject scenario from the forum.   Create the…

1

LINQ to Entities: Compiled Queries

Last Friday I blogged about making local variables behave consistently in LINQ to Entities queries. And the solution I recommended was compiled queries. But just today I realized that I haven’t blogged about compiled queries in general yet.     The main purpose of compiled queries to improve performance. While regular LINQ to Entities queries…

3

Behavior of Variables in LINQ to Entities Queries

LINQ is very nice about referencing local variables without any additional declaration. When I ran my first such LINQ to Entities query, I was ecstatic. The next moment I was puzzled – are the values of those variables picked at compile-time and later used as constants, or are they picked at each execution, so they…

2

How to Parse an EntityDataReader

2007.12.18: Please accept my apologies – today I discovered (and fixed) two bugs in the parsing code. One is a silly error. The other is that collections should be treated as primitive types and refs with regard to the number of fields. The code bellow includes the changes.   2007.12.04: Last week I discovered that…

2