NH is ignoring the property.
Who not ignore it is the proxy-system and you if you want work with
lazy-loading.
You can disable the proxy validation trough a configuration property, after
that you have the responsibility to check the "proxyability" of your class.

2009/3/30 Enrique Ramirez <[email protected]>

>
> Good day,
>
> I'm having an issue where I'm trying to map a private member of a
> class which happens to have a non-virtual public setter Property. I
> noticed that even if I set the access="field" attribute in the
> property tag in the mappings file, as long as NHibernate sees my
> public setter property, it gives an InvalidProxyTypeException. If i
> make my setter property private or virtual public, then everything
> works as planned.
>
> I'm curious though, isn't NHibernate supposed to ignore properties if
> I specify access="field"? I also tried nosetter and got the same
> behavior. Also tried specifying the name strategy and same result.
>
> Code snippets below:
>
> Mapping:
> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
> assembly="DomainModel" namespace="DomainModel">
>  <class name="Test" table="test" lazy="true" proxy="Test">
>    <id name="id" column="id" type="int"
> access="field.lowercase-underscore">
>      <generator class="sequence">
>        <param name="sequence">test_id_seq</param>
>      </generator>
>    </id>
>    <property name="_problematicfield" column="problematicfield"
> type="string" length="50" access="field" not-null="true" />
>  </class>
> </hibernate-mapping>
>
> Class:
>    public class Test
>    {
>        public Test () {}
>
>        private int _id;
>        private string _problematicfield;
>
>        public string ProblematicField
>        {
>            set
>            {
>                _problematicfield =DoSomethingInteresting(value);
>            }
>        }
>    }
>
> --
> ------------------------------------------------------------------
> Enrique Ramirez Irizarry
> Lead Developer, CodaBytes Consulting Group
> http://www.Codabytes.com
> Personal Page: http://www.indiecodelabs.com
>
> >
>


-- 
Fabio Maulo

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to