Print Page | Close Window

Enumeration Classes

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2009
Forum Discription: For .NET 3.5
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=980
Printed Date: 26-Mar-2025 at 7:26am


Topic: Enumeration Classes
Posted By: rclarke
Subject: Enumeration Classes
Date Posted: 29-Oct-2008 at 5:40am
I'm in the process of moving a DevForce Classic application to DevForce EF. In the application I make use of Enumeration Classes which were supported and generated with the Classic Object Mapper. I see no equivilent in DevForce EF Object Mapper and no mention of Enumeration Classes in the EF Developer's Guide. Are they gone? 



Replies:
Posted By: kimj
Date Posted: 29-Oct-2008 at 12:04pm
Enumeration classes are not currently supported in DevForce EF.  We've got this on our feature list, but don't have it scheduled yet.


Posted By: jeffdoolittle
Date Posted: 29-Oct-2008 at 9:10pm
Can you temporarily create the enumeration manually?  Here's an example against a "Category" entity class that is backed by the NorthwindIB.Category table:


      public static Category Beverages() {
          return Beverages(DomainModelEntityManager.DefaultManager);
      }

      public static Category Beverages(EntityManager em) {
          return GetCategoryByName(em, "Beverages");
      }

      public static Category Condiments() {
          return Condiments(DomainModelEntityManager.DefaultManager);
      }

      public static Category Condiments(EntityManager em) {
          return GetCategoryByName(em, "Condiments");
      }

      public static Category Produce() {
          return Produce(DomainModelEntityManager.DefaultManager);
      }

      public static Category Produce(EntityManager em) {
          return GetCategoryByName(em, "Produce");
      }

      private static Category GetCategoryByName(EntityManager em, string categoryName) {
          var query = new EntityQuery<Category>("Categories", em);
          return query.Where(c => c.CategoryName == categoryName).FirstOrNullEntity();
      }



Posted By: rclarke
Date Posted: 30-Oct-2008 at 4:40am
Thanks Jeff,
 
That's exactly what I planed to do and now you have given me a template to use. Great!



Print Page | Close Window