TypeHasDefaultConstructor() public static method

public static TypeHasDefaultConstructor ( Type type, [ argumentName ) : void
type System.Type
argumentName [
return void
Example #1
0
        /// <summary>
        /// Defines a custom builder to use.
        /// </summary>
        /// <param name="definitionType">The type of the <see cref="ContainerDefinition" />.</param>
        public void UseContainer(Type definitionType)
        {
            Guard.AgainstNull(nameof(definitionType), definitionType);
            Guard.TypeHasDefaultConstructor(definitionType, nameof(definitionType));

            Settings.Get <HostingComponent.Settings>().CustomObjectBuilder = definitionType.Construct <ContainerDefinition>().CreateContainer(Settings);
        }
        /// <summary>
        /// Defines a custom builder to use.
        /// </summary>
        /// <param name="definitionType">The type of the <see cref="ContainerDefinition" />.</param>
        public void UseContainer(Type definitionType)
        {
            Guard.AgainstNull(nameof(definitionType), definitionType);
            Guard.TypeHasDefaultConstructor(definitionType, nameof(definitionType));

            UseContainer(definitionType.Construct <ContainerDefinition>().CreateContainer(Settings));
        }
Example #3
0
        /// <summary>
        /// Defines a custom builder to use.
        /// </summary>
        /// <param name="definitionType">The type of the <see cref="ContainerDefinition" />.</param>
        public void UseContainer(Type definitionType)
        {
            Guard.AgainstNull(nameof(definitionType), definitionType);
            Guard.TypeHasDefaultConstructor(definitionType, nameof(definitionType));

            ContainerComponent.UseContainer(definitionType);
        }
Example #4
0
        /// <summary>
        /// Configures NServiceBus to use the given transport.
        /// </summary>
        public static TransportExtensions UseTransport(this BusConfiguration busConfiguration, Type transportDefinitionType)
        {
            Guard.TypeHasDefaultConstructor(transportDefinitionType, "transportDefinitionType");

            busConfiguration.Settings.Set(TransportDefinitionTypeKey, transportDefinitionType);

            return(new TransportExtensions(busConfiguration.Settings));
        }
        /// <summary>
        /// Configures NServiceBus to use the given transport.
        /// </summary>
        public static TransportExtensions UseTransport(this EndpointConfiguration endpointConfiguration, Type transportDefinitionType)
        {
            Guard.AgainstNull(nameof(endpointConfiguration), endpointConfiguration);
            Guard.AgainstNull(nameof(transportDefinitionType), transportDefinitionType);
            Guard.TypeHasDefaultConstructor(transportDefinitionType, nameof(transportDefinitionType));

            var transportDefinition = transportDefinitionType.Construct <TransportDefinition>();

            ConfigureTransport(endpointConfiguration, transportDefinition);
            return(new TransportExtensions(endpointConfiguration.Settings));
        }
Example #6
0
        /// <summary>
        ///     Defines a custom builder to use
        /// </summary>
        /// <param name="definitionType">The type of the builder</param>
        public void UseContainer(Type definitionType)
        {
            Guard.TypeHasDefaultConstructor(definitionType, "definitionType");

            UseContainer(definitionType.Construct <ContainerDefinition>().CreateContainer(Settings));
        }