Autofac.Extras.RegistrationAttributes.ContainerBuilderExtensions.AutoRegistrationSkipCustomRegistration C# (CSharp) Method

AutoRegistrationSkipCustomRegistration() public static method

public static AutoRegistrationSkipCustomRegistration ( this builder, Type type ) : void
builder this
type System.Type
return void
        public static void AutoRegistrationSkipCustomRegistration(this ContainerBuilder builder, Type type)
        {
            var attributes = type
                .GetCustomAttributes(typeof(IAutofacRegistrationAttribute), false)
                .OfType<IAutofacRegistrationAttribute>()
                .ToArray();

            if (attributes.Any() == false) return;

            if (type.IsGenericType)
                RegisterGenericType(builder, type, attributes);
            else
                RegisterType(builder, type, attributes);
        }