Print Page | Close Window

Enums in Entities

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=2803
Printed Date: 13-Apr-2026 at 11:08am


Topic: Enums in Entities
Posted By: bradirby
Subject: Enums in Entities
Date Posted: 29-Jun-2011 at 4:54am
EF does not support enums in the entities.  Does DevForce support this?




Replies:
Posted By: DenisK
Date Posted: 29-Jun-2011 at 1:06pm
Hi bradirby;

DevForce supported enums back in Classic days but we haven't carried the feature forward and haven't seen enough demand to implement it again.

You're right that EF doesn't support enums but they provide workarounds that should also be applicable in DF. Here's a couple of findings.

Using Custom Property (will not work with LINQ query) -  http://cticoder.wordpress.com/2008/08/16/using-enums-with-entity-framework/ - http://cticoder.wordpress.com/2008/08/16/using-enums-with-entity-framework/

Using ComplexType i.e. POCO -  http://blogs.msdn.com/b/alexj/archive/2009/06/05/tip-23-how-to-fake-enums-in-ef-4.aspx - http://blogs.msdn.com/b/alexj/archive/2009/06/05/tip-23-how-to-fake-enums-in-ef-4.aspx

Using a wrapper to change the actual query -  http://landman-code.blogspot.com/2010/08/adding-support-for-enum-properties-on.html - http://landman-code.blogspot.com/2010/08/adding-support-for-enum-properties-on.html

Hope this helps.


Posted By: DenisK
Date Posted: 30-Jun-2011 at 5:52pm
EF June 2011 CTP will somewhat support enums.

http://blogs.msdn.com/b/adonet/archive/2011/06/30/walkthrough-enums-june-ctp.aspx - http://blogs.msdn.com/b/adonet/archive/2011/06/30/walkthrough-enums-june-ctp.aspx


Posted By: stephenmcd1
Date Posted: 30-Jun-2011 at 6:04pm
Originally posted by DenisK

DevForce supported enums back in Classic days but we haven't carried the feature forward and haven't seen enough demand to implement it again.

Consider this a vote for Dev Force to support enums.  We'd like to be using enums in many places in our model but the current limitations you mentioned make it too much effort.  But if EF supports this natively at some point, it would be great if Dev Force could too!

-Stephen


Posted By: DenisK
Date Posted: 05-Jul-2011 at 11:32am
Thanks for the vote and feedback Stephen. I'll let the development team know about this.



Print Page | Close Window