// called when creating wrapper for private (internal) environment of DB; // call must be synchronized on rscLock; db.Evp must be != null, not checked; internal void SetOwnerDatabase(Db db) { evp = db.GetEvp(); databases.Insert(db); isOwnedByDb = true; // so that callbacks can refer back to the DbEnv instance instanceHandle = GCHandle.Alloc(this, GCHandleType.WeakTrackResurrection); evp->api_internal = (IntPtr)instanceHandle; }