private void OnComponentDestroyed(ComponentModel model, object instance)
 {
     if (model.ExtendedProperties.Contains(ManagementConstants.ComponentIsNaturalManageable) ||
         model.ExtendedProperties.Contains(ManagementConstants.ComponentIsNonNaturalManageable))
     {
         _mserver.UnregisterManagedObject(new ManagedObjectName(model.Name));
     }
 }
Example #2
0
        public void TestServerCreation()
        {
            MConnectorServer serverConn =
                MConnectorServerFactory.CreateServer("provider:http:binary:test.rem", null, null);

            AssertNotNull(serverConn);

            ManagedObjectName name = new ManagedObjectName("connector.http:formatter=binary");

            server.RegisterManagedObject(serverConn, name);

            AssertEquals(name, serverConn.ManagedObjectName);

            AppDomain child = null;

            try
            {
                child = AppDomain.CreateDomain(
                    "Child",
                    new System.Security.Policy.Evidence(AppDomain.CurrentDomain.Evidence),
                    AppDomain.CurrentDomain.SetupInformation);

                RemoteClient client = (RemoteClient)
                                      child.CreateInstanceAndUnwrap(typeof(RemoteClient).Assembly.FullName, typeof(RemoteClient).FullName);

                AssertNotNull(client.TestClientCreation());
            }
            finally
            {
                server.UnregisterManagedObject(name);

                if (child != null)
                {
                    AppDomain.Unload(child);
                }
            }
        }
Example #3
0
 public void UnregisterManagedObject(ManagedObjectName name)
 {
     server.UnregisterManagedObject(name);
 }