Germán, yes, that is exactly what I needed. Thanks. Clean and simple.
Krzysztof Germán Schuager pisze: > http://blog.schuager.com/2008/12/nhibernate-read-only-property-access.html > > Is that what you were looking for? > > (I've confused the list with the Castle one, and mistakenly thought > about ActiveRecord) > > > 2009/5/8 Krzysztof Koźmic <[email protected] > <mailto:[email protected]>> > > Germán, > > please expand. And I actually want to do write-only not read-only. > Is there a switch for that? > we are talking about NH, aren't we? > > Krzysztof > > Germán Schuager pisze: >> In NH you'd do: access="readonly" >> >> 2009/5/8 Krzysztof Koźmic <[email protected] >> <mailto:[email protected]>> >> >> Than maybe you should read the first message in this thread >> again. >> >> I have a property that has no backing field, that I want to >> map to a column in DB, but it is readonly, so it should not >> have a setter, but then NH will throw and cfg.Configure() >> >> I want it to be able to PUSH the property to the db but not >> PULL it back when I do SELECT. >> >> Krzysztof >> >> epitka pisze: >>> I am not following what is inconsistent? You either have persistable >>> attribute in your entity or you don't. If you have than you map it. >>> If >>> you don't wan't to expose it to the outside world you make it >>> private. >>> >>> On May 8, 8:38 am, Krzysztof Koźmic <[email protected]> >>> <mailto:[email protected]> >>> wrote: >>> >>>> Why would I want such duplication and inconsitency in my model? >>>> >>>> epitka pisze: >>>> >>>> >>>>> why are you fighting it. Make a field private and let it be >>>>> selected. >>>>> Would that work? >>>>> >>>>> On May 8, 8:17 am, Krzysztof Koźmic <[email protected]> >>>>> <mailto:[email protected]> >>>>> wrote: >>>>> >>>>>> As I think my inline answer went largely unnoticed, I'll try my >>>>>> luck and >>>>>> ask again (sorry to those who seen it already): >>>>>> >>>>>> Isn't there any other way? I thought this is not such uncommon >>>>>> scenario, >>>>>> so people must deal with it somehow... >>>>>> >>>>>> Krzysztof >>>>>> >>>>>> Krzysztof Kozmic pisze: >>>>>> >>>>>>> Thanks Ken >>>>>>> >>>>>>>>>> [email protected] <mailto:[email protected]> 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 >>>>>>> <[email protected] <mailto:[email protected]> >>>>>>> <mailto:[email protected]>> 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 [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 -~----------~----~----~----~------~----~------~--~---
