suggestion 1: don't use nullable object as id, use struct with the
value 0 (or the equivalent for guid) for transient object.
suggestion 2: new is relative to .net object, what you are asking is
if the object is transient
suggestion 3: usually it's not important if an object is or not is
transient (i check it only if i'm debugging), why do you need it?
anyhow try to do this
public static bool IsTransient(ISession session, object obj, string
entityName)
{
ISessionImplementor sessImpl = session.GetSessionImplementation();
bool is Transient = sessImpl.GetEntityPersister(entityName,
obj).IsTransient(obj, sessImpl);
return IsTransient;
}
note: i don't test the code
note2: maybe there's a short/fast way to have the same result
note3: entiotyName usually is the name of the type of obj
--
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.