0
votes

We upgrated Nhibernate to 3.2 and getting problem in following scenarios: Public properties which returns mapped private field value returns NULL

// mapping

<many-to-one lazy="no-proxy" name="Agent" cascade="none" column="`AgentId`" not-null="false" access="field.camelcase-underscore"/>

// Property declared as follow

private Agent _agent;

public Agent Agent
{
   get{ return _agent; }
}

after getting entity from session, then in quick watch I can see value for _agent, but Agent property returns null

1
is it the same with lazy="false"?Firo

1 Answers

1
votes

I think the Agent property should be virtual since NH needs to create a proxy to handle the "no-proxy" setting in a correct way.