Thanks Ken

>>> egoz...@gmail.com 2009-05-08 11:28 >>>
create a "CalculatedHasPets" private property, map it to HasPets in the
DB.
and do not map the HasPets property to anything.

anywhoo this looks a bit bizzarre to my
 
Yeah, it doesn't feel very elegant or persistence ignorant.
Isn't there any other way? I thought this is not such uncommon
scenario, so people must deal with it somehow...


On Fri, May 8, 2009 at 12:24 PM, Krzysztof Kozmic <kkoz...@atsisa.com>
wrote:
Hi,
 
Sorry if the title is confusing, I didn't know how to better describe
what I want to do in few words.
 
Here's longer version.
 
Given I have entity like this:
 
public class Person
{
    public virtual IList<IPet> Pets {get;set;}
    public virtual bool HasPets { get {return Pets.Count > 0;} }
    //More properties
}
 
I want to have the column HasPets in the DB, but I don't want to have a
setter on the property.
How can I tell NHibernate to use the property on Update and Insert but
to ignore it on Select?
 
Krzysztof




CONFIDENTIALITY NOTICE
This message is intended exclusively for the individual or entity to
which it is addressed. This communication may contain information that
is proprietary, privileged, confidential or otherwise legally exempt
from disclosure. If you are not the named addressee, you are not
authorized to read, print, retain, copy or disseminate this message or
any part of it. If you have received this message in error, please
delete all copies of this message and notify the sender immediately by
return mail or fax ATSI S.A.(+4812) 285 36 04.
Any email attachment may contain software viruses which could damage
your own computer system. Whilst reasonable precaution has been taken to
minimise this risk, we cannot accept liability for any damage which you
sustain as a result of software viruses. You should therefore carry out
your own virus checks before opening any attachments.





-- 
Ken Egozi.
http://www.kenegozi.com/blog
http://www.delver.com
http://www.musicglue.com
http://www.castleproject.org
http://www.gotfriends.co.il





CONFIDENTIALITY NOTICE
This message is intended exclusively for the individual or entity to which it 
is addressed. This communication may contain information that is proprietary, 
privileged, confidential or otherwise legally exempt from disclosure. If you 
are not the named addressee, you are not authorized to read, print, retain, 
copy or disseminate this message or any part of it. If you have received this 
message in error, please delete all copies of this message and notify the 
sender immediately by return mail or fax ATSI S.A.(+4812) 285 36 04.
Any email attachment may contain software viruses which could damage your own 
computer system. Whilst reasonable precaution has been taken to minimise this 
risk, we cannot accept liability for any damage which you sustain as a result 
of software viruses. You should therefore carry out your own virus checks 
before opening any attachments.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to nhusers@googlegroups.com
To unsubscribe from this group, send email to 
nhusers+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to