2009/5/26 [email protected] <[email protected]>: > > Actually, I almost like Markus' idea. Thanks for that. I think I > could add a default to the column in the DB. I'm not sure how this > would handle criteria queries Expression.IsNull(child.Parent) etc. A > lazy load of a many-to-one would still load up the placeholder record > which is not ideal. To be more precise, I would create a view that has the nullable key column. This view translates the '0'-key into null and has the instead of trigger that inserts into the actual table with 0 instead of null. In NH you map the entity to the view instead of the table then.
>> 3) oh he hasn't accepted it yet. The argument being that it leaves >> gaps in the IDs. If we have a bigint and the apps restart once a day, >> it isn't going to leave alot of gaps in the IDs. I offered him unique >> identifiers but we all know that didn't go anywhere. You can rebuild Identity by using a table that has the next key per tablename and use that by a stored procedure. In NH you need to implement a custom strategy for it, but it makes everybody happy: REST freaks like the readable keys, Fabio because no identity is used ;-) and your dba because the keys have no gaps. -Markus --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
