NHibernate 1.2beta1
Ths version of NH supports one cool feature that is Custom SQL for inserting, updating or deleting within a mapped class
One thing i was asking myself is if NHibernate even supports mapping the class to a VIEW and not a TABLE, this can be useful in a scenario where we create a
"Surrogate Database Entity"
, for example, given the usual example of User class, we could have a table
UserName Permissions
admin 0x0101b (this is a bitmask)
and another table
PermissionDescription
id description
0x0001 insert
0x0010 update
0x0100 delete
0x1000 someotherstuff
we could create a view in a database (it is pretty simple in sql server using boolean operators) that given the ADMIN user, the result will be
something like
userName PermissionDescription
admin insert
admin delete
(note: we only have insert and delete here - notice the bitmask above)
Now comes the question! :-) Can NHibernate map this view? if this will be possibile, i will add a custom SQL SP call in insert, update and delete that can change the bit value on the bitmask field
And, if views are not supported, i figure i can solve the question using CUSTOM SQL Loading expression, but...what are the limitations ? NHibernate has a PLENTY of features and i cannot fiure what limitations my class may have associating or making part of a collection with other entity classes
Hope i explained well (maybe not...:-) )
|