Project Description
Extensions for Entity Framework 4 to support things like Enums in Linq queries


EF4 Linq Extensions extends EF4 ObjectSet<T> to support queries using enums.

Examples

Query:
// this query will be executed against the database as expected
// any use of enums will be translated to use backing integer properties

var orders = from order in context.Orders.Extend()
             where order.Status == OrderStatus.Shipped
             select order;


Mapping:
class Order
{
   //other properties

   //hidden integer property mapped to the database
   //Note: current convention is lower case "e" + enum property name for backing integer properties
   private int eStatus {get;set;}

   // unmapped property for linq queries
   // any linq query against this property will be translated to use the backing integer property instead
   public OrderStatus Status
   {
         get { return (OrderStatus)eStatus;}
         set { eStatus = (int)value;}
   }
}

Last edited Jan 13, 2011 at 11:51 AM by Roggan, version 23