private void OnComponentCreated(ComponentModel model, object instance)
        {
            if (model.ExtendedProperties.Contains(ManagementConstants.ComponentIsNaturalManageable))
            {
                _mserver.RegisterManagedObject(instance, new ManagedObjectName(model.Name));
            }
            else if (model.ExtendedProperties.Contains(ManagementConstants.ComponentIsNonNaturalManageable))
            {
                DefaultMDynamicSupport dynamic =
                    new DefaultMDynamicSupport(
                        instance,
                        model.Configuration.Children["management"]);

                _mserver.RegisterManagedObject(dynamic, new ManagedObjectName(model.Name));
            }
        }
Beispiel #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);
                }
            }
        }
Beispiel #3
0
 public ManagedInstance RegisterManagedObject(Object instance, ManagedObjectName name)
 {
     return(server.RegisterManagedObject(instance, name));
 }