I think it's a fine practice, as long as the unsaved-value is specified as "null" (so you accept that you won't have an actual ID on the entity until you call Session.Save). It's really no different than having an empty Guid (all zeros) to represent that "this entity has not yet been saved".
From: [email protected] [mailto:[email protected]] On Behalf Of Gunnar Liljas Sent: Monday, September 17, 2012 2:42 PM To: [email protected] Subject: Re: [nhusers] Using Nullable Guid (Guid?) for the ID of the POCO classes That would be a really bad practice. The ID is supposed to identifying the entity, and if it's null is has no identity, Fix your validation (why is GUID a problem?) or change the key type. /G 2012/9/17 indra kurniawan <[email protected]<mailto:[email protected]>> Hi all, I've never found any samples using nullable guid as the ID for domain classes; is this a bad practice? isn't it just like using a string as the ID? (I still use Guid.comb for the primary key on the database) Thank you for your help. The motive: I have simple poco that I sent out to UI layer as list; I cannot use build in validation available for the UI if I use GUID as the key data type. -- You received this message because you are subscribed to the Google Groups "nhusers" group. To view this discussion on the web visit https://groups.google.com/d/msg/nhusers/-/wquon1KCqFUJ. To post to this group, send email to [email protected]<mailto:[email protected]>. To unsubscribe from this group, send email to [email protected]<mailto:nhusers%[email protected]>. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en. -- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected]<mailto:[email protected]>. To unsubscribe from this group, send email to [email protected]<mailto:[email protected]>. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en. -- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
