Home
Help
Register
Log in

Search

 
   Active Threads  

You are here: Home > LLBLGen Pro > LLBLGen Pro Runtime Framework> EntityType enum
 

Pages: 1
LLBLGen Pro Runtime Framework
EntityType enum
Page:1/1 

  Print all messages in this thread  
Poster Message
omar
User



Location:
Salmiya, Kuwait
Joined on:
15-Oct-2004 15:44:57
Posted:
569 posts
# Posted on: 08-Oct-2009 13:38:48.  
I came across this issue and somehow I know I have raised it before on the forum.

The EntityType enum that is generated as part of the DAL starts its value from 0 (zero). I came across the case where some of my utility functions need to return an EntityType value or not.

The case of not would be most conveniant if used the value 0 (zero) that can easily be checked for.

Does it make sense to have the LLBL templates generate their enum values starting from 1 instead of 0 (zero) to cater for cases like this one ?
We don't know who we are until we see what we can do  Top
daelmo
Support Team



Location:
Guatemala City
Joined on:
28-Nov-2005 23:35:24
Posted:
8098 posts
# Posted on: 09-Oct-2009 05:17:19.  
Hi Omar,
Why not use just nullable int? for your retun value?


David Elizondo
LLBLGen'ing (articles and code snippets) | linkedin | twitter
 
Top
omar
User



Location:
Salmiya, Kuwait
Joined on:
15-Oct-2004 15:44:57
Posted:
569 posts
# Posted on: 10-Oct-2009 18:49:28.  
Indeed thats a great idea. The downturn I see in int? approach:

1- (annoyance) The helper functions will return int? instead of the EntityType enum. This meanes consumers have to always check for null and then do the appropiate casting

2- (issue) some developers still tend to define a variable as EntityType and do not initialize it. This tends to introduce runt-time logical errors that could hard or tricky to catch specially in projects with multiple developer teams.

That said I do agree the int? is a viable option though having Unkown=0 as the first enum value is safer and more conveniant.
We don't know who we are until we see what we can do  Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
37797 posts
# Posted on: 11-Oct-2009 11:18:15.  
I could add 'Unknown' or 'None' at position 0 in v3, that's not that much of a problem. Though for this purpose, IMHO int? is also an option, though agreed, nullable types are sometimes a pain to work with.

Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
omar
User



Location:
Salmiya, Kuwait
Joined on:
15-Oct-2004 15:44:57
Posted:
569 posts
# Posted on: 11-Oct-2009 14:24:00.  
Frans.. maybe you can add it a simple checkbox in v3 designer to handle the option of adding a zero value for the generated EntityType enum
We don't know who we are until we see what we can do  Top
mohamed
User



Location:
Salmia, kuwait
Joined on:
10-Mar-2008 19:55:21
Posted:
136 posts
# Posted on: 10-Mar-2011 22:37:30.  
Otis wrote:
I could add 'Unknown' or 'None' at position 0 in v3, that's not that much of a problem. Though for this purpose, IMHO int? is also an option, though agreed, nullable types are sometimes a pain to work with.


Is there any news about this !!!


  Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
37797 posts
# Posted on: 11-Mar-2011 13:40:29.  
No news, same as before.
Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
Pages: 1  


Powered by HnD ©2002-2007 Solutions Design
HnD uses LLBLGen Pro

Version: 2.1.12172008 Final.