Hi,

I'm sure it should be simple. How can I assign property (lookup value)
without a DB roundtrip to obtain ID of the lookup?

// THIS IS WHAT I USED TO DO
address.Country = Session.Get<Country>(14);

 // THIS IS WHAT DO NOW
address.Country = PredefinedCountries.Australia;

The last approach work ONLY if the Country has not been loaded into Session.
NonUniqueObjectException is thrown.

So I have to Evict the object first or just load the actual object (using
the approach 1).

How can I avoid doing Evict in this case?

And yes, I did override Equals and GetHashCode (even == operators).

I saw custom user type approach:
http://www.lostechies.com/blogs/jimmy_bogard/archive/2008/08/12/enumeration-classes.aspx
But it is overkill for my need.

Cheers,
Dmitriy.

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