Esempio n. 1
0
        public virtual ObjectHandle CreateInstance(ActivationContext activationContext, string[] activationCustomData)
        {
            if (activationContext == null)
            {
                throw new ArgumentNullException("activationContext");
            }
            Contract.EndContractBlock();

            if (CmsUtils.CompareIdentities(AppDomain.CurrentDomain.ActivationContext, activationContext))
            {
                ManifestRunner runner = new ManifestRunner(AppDomain.CurrentDomain, activationContext);
                return(new ObjectHandle(runner.ExecuteAsAssembly()));
            }

            AppDomainSetup adSetup = new AppDomainSetup(new ActivationArguments(activationContext, activationCustomData));

            // inherit the calling domain's AppDomain Manager
            AppDomainSetup currentDomainSetup = AppDomain.CurrentDomain.SetupInformation;

            adSetup.AppDomainManagerType     = currentDomainSetup.AppDomainManagerType;
            adSetup.AppDomainManagerAssembly = currentDomainSetup.AppDomainManagerAssembly;

            // we inherit the evidence from the calling domain
            return(CreateInstanceHelper(adSetup));
        }
 public virtual ObjectHandle CreateInstance(ActivationContext activationContext, string[] activationCustomData)
 {
     if (activationContext == null)
     {
         throw new ArgumentNullException("activationContext");
     }
     if (CmsUtils.CompareIdentities(AppDomain.CurrentDomain.ActivationContext, activationContext))
     {
         ManifestRunner runner = new ManifestRunner(AppDomain.CurrentDomain, activationContext);
         return new ObjectHandle(runner.ExecuteAsAssembly());
     }
     AppDomainSetup adSetup = new AppDomainSetup(new ActivationArguments(activationContext, activationCustomData));
     return CreateInstanceHelper(adSetup);
 }
Esempio n. 3
0
        public virtual ObjectHandle CreateInstance(ActivationContext activationContext, string[] activationCustomData)
        {
            if (activationContext == null)
            {
                throw new ArgumentNullException("activationContext");
            }
            if (CmsUtils.CompareIdentities(AppDomain.CurrentDomain.ActivationContext, activationContext))
            {
                ManifestRunner runner = new ManifestRunner(AppDomain.CurrentDomain, activationContext);
                return(new ObjectHandle(runner.ExecuteAsAssembly()));
            }
            AppDomainSetup adSetup = new AppDomainSetup(new ActivationArguments(activationContext, activationCustomData));

            return(CreateInstanceHelper(adSetup));
        }
        public virtual ObjectHandle CreateInstance(ActivationContext activationContext, string[] activationCustomData)
        {
            if (activationContext == null)
            {
                throw new ArgumentNullException("activationContext");
            }
            if (CmsUtils.CompareIdentities(AppDomain.CurrentDomain.ActivationContext, activationContext))
            {
                ManifestRunner manifestRunner = new ManifestRunner(AppDomain.CurrentDomain, activationContext);
                return(new ObjectHandle(manifestRunner.ExecuteAsAssembly()));
            }
            AppDomainSetup appDomainSetup   = new AppDomainSetup(new ActivationArguments(activationContext, activationCustomData));
            AppDomainSetup setupInformation = AppDomain.CurrentDomain.SetupInformation;

            appDomainSetup.AppDomainManagerType     = setupInformation.AppDomainManagerType;
            appDomainSetup.AppDomainManagerAssembly = setupInformation.AppDomainManagerAssembly;
            return(ApplicationActivator.CreateInstanceHelper(appDomainSetup));
        }
        public virtual ObjectHandle CreateInstance (ActivationContext activationContext, string[] activationCustomData) {
            if (activationContext == null)
                throw new ArgumentNullException("activationContext");
            Contract.EndContractBlock();

            if (CmsUtils.CompareIdentities(AppDomain.CurrentDomain.ActivationContext, activationContext)) {
                ManifestRunner runner = new ManifestRunner(AppDomain.CurrentDomain, activationContext);
                return new ObjectHandle(runner.ExecuteAsAssembly());
            }

            AppDomainSetup adSetup = new AppDomainSetup(new ActivationArguments(activationContext, activationCustomData));

            // inherit the calling domain's AppDomain Manager
            AppDomainSetup currentDomainSetup = AppDomain.CurrentDomain.SetupInformation;
            adSetup.AppDomainManagerType = currentDomainSetup.AppDomainManagerType;
            adSetup.AppDomainManagerAssembly = currentDomainSetup.AppDomainManagerAssembly;
            
            // we inherit the evidence from the calling domain
            return CreateInstanceHelper(adSetup);
        }