The Edm.Length() Canonical Function over SqlClient

I recently blogged about canonical functions in Entity Framework and SQL Server’s LEN() function. The purpose of those two posts was to lay out the foundation for this one, and to allow it to be brief and coherent. Please read those two posts before proceeding.   If you’ve been using the Edm.Length() canonical function from…


SQL Server’s LEN() Function

There is a peculiarity around the LEN() function in SQL Server that not many people have realized or paid attention to. It’s the treatment of trailing spaces. The documentation says:           “Returns the number of characters of the specified string expression, excluding trailing blanks.” (The highlighting is mine.)   Indeed           SELECT LEN(‘abc’), LEN(‘abc         ‘);…


Entity Framework and Object/Relational Mapping

Often, people categorize Entity Framework as an Object/Relational Mapper and try to compare it to other O/R Mappers. I dare say that’s an apples-to-oranges kind of comparison. While Entity Framework does have ORM capabilities, that is only a fraction of its functionality, and more importantly, those ORM capabilities are achieved through a fundamentally different approach…


eSqlBlast – The Ultimate Tool for Writing Entity SQL Queries

2007.12.18: Today I posted an update to How to Parse an EntityDataReader – I discovered (and fixed) two bugs in the parsing code. Since the code is taken from eSqlBlast, the same fix should be applied to it too. The code is in project Core, class XmlVisitor, method VisitRecord. I’ll try to push a refresh to CodePlex soon. Sorry…


Entity Framework Beta 3 Is Available for Download

Entity Framework Beta 3 and related packages are available for public download: ·         Entity Framework Runtime: ·         Entity Framework Tools:        ·         Entity Framework Samples:   ·         Entity Framework Documentation:  


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…


Definition: API

API = syntax + behavior


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…


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…