protected virtual void OnRegisterService(ServiceContainerEventArgs e) { if (!IsServiceValid(e.ServiceType, e.Instance)) throw new ArgumentException(RM.GetString("ErrInvalidServiceInstance", e.ServiceType.FullName)); ServiceContainerEventHandler h = this.RegisterService; if (h != null) h(this, e); }
protected virtual void OnUnregisterService(ServiceContainerEventArgs e) { ServiceContainerEventHandler h = this.UnregisterService; if (h != null) h(this, e); }
protected override void OnUnregisterService(ServiceContainerEventArgs e) { try { MarshalByRefObject mbo = e.Instance as MarshalByRefObject; if (mbo != null) UnregisterSponsor(mbo); } catch (System.Security.SecurityException ex) { // похоже нам нельзя спонсорить этот объект. Игнорируем. System.Diagnostics.Trace.WriteLine(ex); } base.OnUnregisterService(e); }