Thanks, everyone, for the responses! It was, as a couple of people
have suggested, a customized getter-setter in the Contact class. The
State property looked like the following:
public virtual string State
{
get
{
return m_strState != null ? m_strState.Trim() :
null;
}
set
{
m_strState = value != null ? value.Trim() :
null;
}
}
Once that property was changed to simply expose the m_strState
variable, no update occurred upon materialization of the list of
Contacts. Thanks for the help! It's wonderful to see such a
responsive community around a tool like this! Eat your heart out,
StackOverflow! ;-)
-Brian
On Jun 29, 3:13 pm, Oskar Berggren <[email protected]> wrote:
> 2009/6/29 Brian Sullivan <[email protected]>:
>
>
>
> > Oskar,
>
> > Thanks for the reply! Yes, it looks like calling ToList() does cause
> > the update to happen as well (once I call session.Flush()). I'm not
> > sure if anything is actually being updated, since unfortunately SQL
> > Profiler doesn't provide the values for the "@" params in its
>
> This should be a matter of enabling the correct columns in the
> profiler, though at this time I don't remember which. Use can also
> enable logging using log4net. Set level for NHibernate.SQL to DEBUG,
> this will make it output all SQL queries, including parameters. With
> DEBUG logging for all NHibernate perhaps you can also see where it
> detects the dirty object. Though other approaches may be easier to try
> first.
>
> > display. I'd have to check the values in the table. However, the
> > fact that an UPDATE is being issued at all is cause for concern.
>
> > You mentioned NULLs in varchar columns being a potential problem. I
> > know for certain that some of the varchar fields in the Contacts table
> > are nullable. How can I verify that this is indeed what's happening
> > to cause the update, and how can I best address it?
>
> They shouldn't magically change of course, just by being NULL. Do you
> have something in your class that might not give the same value back
> after being set, for some value? Can you post your class and you
> mapping?
>
> As for the NULL varchar, a brute force method would of course be to
> set them all to the empty string in one go, then all NULL in another
> go. Run your test inbetween to see if it still updates anything. But I
> think you should first try to get some SQL logs from NHibernate.
>
> /Oskar
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---