Exemplo n.º 1
0
 public StageBuilder(IBuilderProvider builderProvider, ITypeLoader typeLoader, ILogger logger, IPipelineCreationContext context)
 {
     this.builderProvider = builderProvider;
     this.typeLoader      = typeLoader;
     this.logger          = logger;
     this.context         = context;
 }
Exemplo n.º 2
0
        /// <summary> Uses RabbitMQ messages as the input for a pipe </summary>
        public static IBuilder <RabbitMqConfig, Receive> UseRabbitMQ(this IBuilderProvider builderProviderFactory)
        {
            if (Equals(null, builderProviderFactory))
            {
                throw new ArgumentNullException(nameof(builderProviderFactory));
            }

            return(builderProviderFactory.For(new Builder()));
        }
Exemplo n.º 3
0
        // *******************************************************************

        /// <summary>
        /// This method adds a child to the provider.
        /// </summary>
        /// <param name="provider">The provider to add.</param>
        void IBuilderProvider.AddChild(
            IBuilderProvider provider
            )
        {
            // Validate the parameter before attempting to use it.
            new Guard().ThrowIfNull(provider, nameof(provider));

            // Add the child provider.
            _children.Add(provider);
        }
Exemplo n.º 4
0
        // *******************************************************************

        /// <summary>
        /// This constructor creates a new instance of the <see cref="BuilderBase"/>
        /// class, that is embedded inside an existing parent product.
        /// </summary>
        /// <param name="parentProvider">A parent provider reference.</param>
        protected BuilderBase(
            IBuilderProvider parentProvider
            )
        {
            // Validate the parameter before attempting to use it.
            new Guard().ThrowIfNull(parentProvider, nameof(parentProvider));

            // Save the collection of child providers.
            _externalProviders = parentProvider.Children;
        }
Exemplo n.º 5
0
        public CommandProducer(IBuilderProvider provider, IScene scene)
        {
            foreach (var tempBuilder in provider.GetBuilders())
            {
                var builder = tempBuilder(scene);
                this.commands.Add(new Regex(builder.Pattern), tempBuilder);
            }

            this.scene = scene;
        }
Exemplo n.º 6
0
        // *******************************************************************

        /// <summary>
        /// This method exposes the <see cref="IBuilderProduct.AddProvider"/> method on a
        /// <see cref="ProductBase"/> object, in order to avoid the need to
        /// constantly downcast.
        /// </summary>
        /// <param name="product">A <see cref="ProductBase"/> reference.</param>
        /// <param name="provider">The provider to add.</param>
        public static void AddProvider(
            this ProductBase product,
            IBuilderProvider provider
            )
        {
            // Validate the parameters before attempting to use them.
            new Guard().ThrowIfNull(product, nameof(product))
            .ThrowIfNull(provider, nameof(provider));

            // Downcast and perform the operation.
            ((IBuilderProduct)product).AddProvider(provider);
        }
Exemplo n.º 7
0
        // *******************************************************************

        /// <summary>
        /// This method exposes the <see cref="IBuilderProvider.AddChild(IBuilderProvider)"/> method
        /// on a <see cref="ProviderBase"/> object, in order to avoid the need to
        /// constantly downcast.
        /// </summary>
        /// <param name="provider">A <see cref="ProviderBase"/> reference.</param>
        /// <param name="child">The provider to add as a child.</param>
        public static void AddChild(
            this ProviderBase provider,
            IBuilderProvider child
            )
        {
            // Validate the parameters before attempting to use them.
            new Guard().ThrowIfNull(provider, nameof(provider))
            .ThrowIfNull(child, nameof(child));

            // Downcast and perform the operation.
            ((IBuilderProvider)provider).AddChild(child);
        }
Exemplo n.º 8
0
 public PipelineBuilder(
     IBuilderProvider builderProvider,
     IPipelineWorkspaceManagers workspaceManagers,
     string basePath,
     IFileSystem fileSystem,
     ITypeLoader typeLoader,
     ILogger logger)
 {
     this.builderProvider   = builderProvider;
     this.workspaceManagers = workspaceManagers;
     this.basePath          = basePath;
     this.fileSystem        = fileSystem;
     this.typeLoader        = typeLoader;
     this.logger            = logger;
 }
Exemplo n.º 9
0
        bool ParseKeyValuePair(IBuilderProvider builderProvider, out KeyValuePair <string, object> result)
        {
            string key;

            if (!ParseTextString(out key))
            {
                result = default(KeyValuePair <string, object>);
                return(false);
            }

            Token(':');
            Whitespace();

            var value = default(object);

            if (!ParseJsonValue(() => builderProvider.GetObjectValueBuilderProvider(key), ref value))
            {
                Fail("expected valid json value");
            }

            result = new KeyValuePair <string, object>(key, value);
            return(true);
        }
Exemplo n.º 10
0
        bool ParseKeyValuePair(IBuilderProvider builderProvider, out KeyValuePair<string, object> result)
        {
            string key;
            if (!ParseTextString(out key))
            {
                result = default(KeyValuePair<string, object>);
                return false;
            }

            Token(':');
            Whitespace();

            var value = default(object);
            if (!ParseJsonValue(() => builderProvider.GetObjectValueBuilderProvider(key), ref value))
                Fail("expected valid json value");

            result = new KeyValuePair<string, object>(key, value);
            return true;
        }
Exemplo n.º 11
0
        // *******************************************************************

        /// <summary>
        /// This constructor creates a new instance of the <see cref="PluralizationApiBuilder"/>
        /// class.
        /// </summary>
        /// <param name="parentProvider">A parent provider reference, for constructing
        /// a <see cref="IBuilderProvider"/> reference as part of a larger object graph.</param>
        public PluralizationApiBuilder(
            IBuilderProvider parentProvider
            ) : base(parentProvider)
        {
        }
Exemplo n.º 12
0
        // *******************************************************************

        /// <summary>
        /// This method adds a new provider to the product.
        /// </summary>
        /// <param name="provider">The provider to add.</param>
        void IBuilderProduct.AddProvider(IBuilderProvider provider)
        {
            _providers.Add(provider);
        }
Exemplo n.º 13
0
 public SqlQueryBuilderContext(IDbConnection connection, IBuilderProvider provider) : base(connection)
 {
     Provider = provider;
 }
Exemplo n.º 14
0
 public SqlQueryBuilderContext(DbConnectionStringBuilder connectionString, IBuilderProvider provider)
     : base(connectionString)
 {
     Provider = provider;
 }
Exemplo n.º 15
0
 public SqlQueryBuilderContext(string nameOrConnectionString, IBuilderProvider provider)
     : base(nameOrConnectionString)
 {
     Provider = provider;
 }