/// <summary> /// /// </summary> /// <param name="connection"></param> /// <param name="factory"></param> /// <param name="autoClose"></param> /// <param name="timestamp"></param> /// <param name="interceptor"></param> internal SessionImpl( IDbConnection connection, SessionFactoryImpl factory, bool autoClose, long timestamp, IInterceptor interceptor ) { if(interceptor == null) throw new ArgumentNullException("interceptor", "The interceptor can not be null"); this.connection = connection; connect = connection == null; this.interceptor = interceptor; this.autoClose = autoClose; this.timestamp = timestamp; this.factory = factory; entitiesByKey = new Hashtable( 50 ); proxiesByKey = new Hashtable( 10 ); nonExists = new HashedSet(); //TODO: hack with this cast entityEntries = ( IdentityMap ) IdentityMap.InstantiateSequenced( 50 ); collectionEntries = ( IdentityMap ) IdentityMap.InstantiateSequenced( 30 ); collectionsByKey = new Hashtable( 30 ); arrayHolders = ( IdentityMap ) IdentityMap.Instantiate( 10 ); insertions = new ArrayList( 20 ); deletions = new ArrayList( 20 ); updates = new ArrayList( 20 ); collectionCreations = new ArrayList( 20 ); collectionRemovals = new ArrayList( 20 ); collectionUpdates = new ArrayList( 20 ); InitTransientState(); log.Debug( "opened session" ); }
public IdentitySet() { map = IdentityMap.Instantiate(10); }
/// <summary> /// Constructor used to recreate the Session during the deserialization. /// </summary> /// <param name="info"></param> /// <param name="context"></param> /// <remarks> /// This is needed because we have to do some checking before the serialization process /// begins. I don't know how to add logic in ISerializable.GetObjectData and have .net /// write all of the serializable fields out. /// </remarks> protected SessionImpl( SerializationInfo info, StreamingContext context ) { this.autoClose = info.GetBoolean( "autoClose" ); this.timestamp = info.GetInt64( "timestamp" ); this.factory = ( SessionFactoryImpl ) info.GetValue( "factory", typeof( SessionFactoryImpl ) ); this.entitiesByKey = ( IDictionary ) info.GetValue( "entitiesByKey", typeof( IDictionary ) ); // we did not actually serializing the IDictionary but instead the proxies in an arraylist //this.proxiesByKey = (IDictionary)info.GetValue( "proxiesByKey", typeof(IDictionary) ); tmpProxiesKey = ( ArrayList ) info.GetValue( "tmpProxiesKey", typeof( ArrayList ) ); tmpProxiesProxy = ( ArrayList ) info.GetValue( "tmpProxiesProxy", typeof( ArrayList ) ); this.entityEntries = ( IdentityMap ) info.GetValue( "entityEntries", typeof( IdentityMap ) ); this.collectionEntries = ( IdentityMap ) info.GetValue( "collectionEntries", typeof( IdentityMap ) ); this.collectionsByKey = ( IDictionary ) info.GetValue( "collectionsByKey", typeof( IDictionary ) ); this.arrayHolders = ( IdentityMap ) info.GetValue( "arrayHolders", typeof( IdentityMap ) ); this.nonExists = ( ISet ) info.GetValue( "nonExists", typeof( ISet ) ); this.closed = info.GetBoolean( "closed" ); this.flushMode = ( FlushMode ) info.GetValue( "flushMode", typeof( FlushMode ) ); this.isCurrentTransaction = info.GetBoolean( "isCurrentTransaction" ); this.nullifiables = ( ISet ) info.GetValue( "nullifiables", typeof( ISet ) ); this.interceptor = ( IInterceptor ) info.GetValue( "interceptor", typeof( IInterceptor ) ); this.insertions = ( ArrayList ) info.GetValue( "insertions", typeof( ArrayList ) ); this.deletions = ( ArrayList ) info.GetValue( "deletions", typeof( ArrayList ) ); this.updates = ( ArrayList ) info.GetValue( "updates", typeof( ArrayList ) ); this.collectionCreations = ( ArrayList ) info.GetValue( "collectionCreations", typeof( ArrayList ) ); this.collectionUpdates = ( ArrayList ) info.GetValue( "collectionUpdates", typeof( ArrayList ) ); this.collectionRemovals = ( ArrayList ) info.GetValue( "collectionRemovals", typeof( ArrayList ) ); }