コード例 #1
0
        public void LoadFlushedCode(_Assembly assembly)
        {
            ArgumentUtility.CheckNotNull("assembly", assembly);

            var typePipeAttribute =
                (TypePipeAssemblyAttribute)assembly.GetCustomAttributes(typeof(TypePipeAssemblyAttribute), inherit: false).SingleOrDefault();

            if (typePipeAttribute == null)
            {
                throw new ArgumentException("The specified assembly was not generated by the pipeline.", "assembly");
            }

            if (typePipeAttribute.ParticipantConfigurationID != _typeAssembler.ParticipantConfigurationID)
            {
                var message = string.Format(
                    "The specified assembly was generated with a different participant configuration: '{0}'.",
                    typePipeAttribute.ParticipantConfigurationID);
                throw new ArgumentException(message, "assembly");
            }

            _typeCache.LoadTypes(assembly.GetTypes());
        }
コード例 #2
0
 private static bool TryGetAttribute <T>(_Assembly assembly, out T attribute)
     where T : Attribute
 {
     attribute = (T)assembly.GetCustomAttributes(typeof(T), false).FirstOrDefault();
     return(attribute != null);
 }