PreLoad() public static method

public static PreLoad ( Assembly assembly ) : void
assembly System.Reflection.Assembly
return void
Beispiel #1
0
 /// <summary>Preloads every <see cref="T:System.Type" /> found in the specified <see cref="T:System.Reflection.Assembly" /> from the information found in the <see cref="T:System.Runtime.Remoting.Metadata.SoapTypeAttribute" /> associated with each type.</summary>
 /// <param name="assembly">The <see cref="T:System.Reflection.Assembly" /> for each type of which to call <see cref="M:System.Runtime.Remoting.SoapServices.PreLoad(System.Type)" />. </param>
 /// <exception cref="T:System.Security.SecurityException">The immediate caller does not have infrastructure permission. </exception>
 /// <PermissionSet>
 ///   <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
 /// </PermissionSet>
 public static void PreLoad(Assembly assembly)
 {
     foreach (Type type in assembly.GetTypes())
     {
         SoapServices.PreLoad(type);
     }
 }
 internal void StoreInteropEntries(RemotingXmlConfigFileData configData)
 {
     foreach (RemotingXmlConfigFileData.InteropXmlElementEntry entry in configData.InteropXmlElementEntries)
     {
         Type type = Assembly.Load(entry.UrtAssemblyName).GetType(entry.UrtTypeName);
         SoapServices.RegisterInteropXmlElement(entry.XmlElementName, entry.XmlElementNamespace, type);
     }
     foreach (RemotingXmlConfigFileData.InteropXmlTypeEntry entry2 in configData.InteropXmlTypeEntries)
     {
         Type type2 = Assembly.Load(entry2.UrtAssemblyName).GetType(entry2.UrtTypeName);
         SoapServices.RegisterInteropXmlType(entry2.XmlTypeName, entry2.XmlTypeNamespace, type2);
     }
     foreach (RemotingXmlConfigFileData.PreLoadEntry entry3 in configData.PreLoadEntries)
     {
         Assembly assembly = Assembly.Load(entry3.AssemblyName);
         if (entry3.TypeName != null)
         {
             SoapServices.PreLoad(assembly.GetType(entry3.TypeName));
         }
         else
         {
             SoapServices.PreLoad(assembly);
         }
     }
 }
Beispiel #3
0
 public static void PreLoad(Assembly assembly)
 {
     if (assembly == (Assembly)null)
     {
         throw new ArgumentNullException("assembly");
     }
     if (!(assembly is RuntimeAssembly))
     {
         throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeAssembly"), "assembly");
     }
     foreach (Type type in assembly.GetTypes())
     {
         SoapServices.PreLoad(type);
     }
 }
Beispiel #4
0
        private void ReadPreload(SmallXmlParser.IAttrList attrs)
        {
            string value  = attrs.GetValue("type");
            string value2 = attrs.GetValue("assembly");

            if (value != null && value2 != null)
            {
                throw new RemotingException("Type and assembly attributes cannot be specified together");
            }
            if (value != null)
            {
                SoapServices.PreLoad(Type.GetType(value));
            }
            else
            {
                if (value2 == null)
                {
                    throw new RemotingException("Either type or assembly attributes must be specified");
                }
                SoapServices.PreLoad(Assembly.Load(value2));
            }
        }
Beispiel #5
0
        void ReadPreload(SmallXmlParser.IAttrList attrs)
        {
            string type = attrs.GetValue("type");
            string assm = attrs.GetValue("assembly");

            if (type != null && assm != null)
            {
                throw new RemotingException("Type and assembly attributes cannot be specified together");
            }

            if (type != null)
            {
                SoapServices.PreLoad(Type.GetType(type));
            }
            else if (assm != null)
            {
                SoapServices.PreLoad(Assembly.Load(assm));
            }
            else
            {
                throw new RemotingException("Either type or assembly attributes must be specified");
            }
        }