public static object GetIdentifier( object obj, IClassPersister persister ) { if( obj is INHibernateProxy ) { INHibernateProxy proxy = ( INHibernateProxy ) obj; LazyInitializer li = GetLazyInitializer( proxy ); return li.Identifier; } else { return persister.GetIdentifier( obj ); } }
public static object GetIdentifier(object obj, IClassPersister persister) { if (obj is INHibernateProxy) { INHibernateProxy proxy = ( INHibernateProxy )obj; LazyInitializer li = GetLazyInitializer(proxy); return(li.Identifier); } else { return(persister.GetIdentifier(obj)); } }
private static void CheckId( object obj, IClassPersister persister, object id ) { // make sure user didn't mangle the id if( persister.HasIdentifierPropertyOrEmbeddedCompositeIdentifier ) { object oid = persister.GetIdentifier( obj ); if( id == null ) { throw new AssertionFailure( "null id in entry (don't flush the Session after an exception occurs)" ); } if( !id.Equals( oid ) ) { throw new HibernateException( string.Format( "identifier of an instance of {0} altered from {1} ({2}) to {3} ({4})", persister.ClassName, id, id.GetType(), oid, oid.GetType() ) ); } } }