Development With A Dot

Blog on development in general, and specifically on .NET

Sponsors

News

My Friends

My Links

Permanent Posts

Portuguese Communities

Entity Framework Pitfalls – Cannot Return Complex Types From SQL Queries

Clarified: thanks, Diego!

Methods in Entity Framework that return entities from SQL queries, such as DbSet<T>.SqlQuery and ObjectContext.ExecuteStoreQuery, cannot create complex types as parts of an entity. This is a known problem, whose resolution you can track here: Support entities with complex types in SqlQuery (ExecuteStoreQuery and Translate).

There isn’t much you can do about it at the moment, we will just have to wait for this to be implemented.

Comments

diego said:

You can return instances of complex types on raw SQL queries. What you can't do is return graphs of objects, e.g. entities that contain properties of complex types.

# August 31, 2013 4:30 PM

Ricardo Peres said:

Diego:

Thanks, that's what I MEANT to say, not what I SAID!

:-)

# August 31, 2013 5:04 PM