示例#1
0
 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);
 }
示例#2
0
 protected virtual void OnUnregisterService(ServiceContainerEventArgs e)
 {
     ServiceContainerEventHandler h = this.UnregisterService;
     if (h != null) h(this, e);
 }
示例#3
0
 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);
 }