예제 #1
0
 /// <summary>
 /// Initialize type list.
 /// </summary>
 /// <param name="idl"></param>
 public static void Initialize(InterfaceDefinitionList idl)
 {
     Trace.WriteLine("in RemotingServer.Initialize");
     lock ( _syncRoot )
     {
         foreach (InterfaceDefinition intf in idl)
         {
             Type intfType = Type.GetType(intf.Interface);
             Type implType = Type.GetType(intf.Implementor);
             _Add
             (
                 intfType,
                 implType);
         }
     }
 }
예제 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="assembly"></param>
        /// <returns></returns>
        public static InterfaceDefinitionList FromAssembly(Assembly assembly)
        {
            InterfaceDefinitionList result = new InterfaceDefinitionList();

            foreach (Type implementor in assembly.GetTypes())
            {
                FactoryClassAttribute fca =
                    ReflectionUtility
                    .GetCustomAttribute <FactoryClassAttribute>
                        (implementor);
                if (fca != null)
                {
                    result.Add
                    (
                        fca.Interface,
                        implementor);
                }
            }

            return(result);
        }