Exemplo n.º 1
0
        /// <summary>
        /// Replaces any existing <see cref="IContainerConfig{ITargetCompiler}"/> with the passed <paramref name="configuration"/> -
        /// thus ensuring that any <see cref="Container"/> objects which are initialised with the config collection will use whichever
        /// compiler that is configured when the configuration's <see cref="IContainerConfig.Configure(Container, IRootTargetContainer)"/> method
        /// is called.
        /// </summary>
        /// <param name="collection"></param>
        /// <param name="configuration"></param>
        /// <returns></returns>
        public static CombinedContainerConfig UseCompiler(this CombinedContainerConfig collection, IContainerConfig <ITargetCompiler> configuration)
        {
            if (collection == null)
            {
                throw new ArgumentNullException(nameof(collection));
            }

            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }

            collection.ReplaceAnyOrAdd <IContainerConfig <ITargetCompiler> >(configuration);
            return(collection);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Replaces any existing <see cref="IContainerConfig{ITargetCompiler}" /> in the collection with the
 /// <see cref="ExpressionCompilation.Instance"/> from <see cref="ExpressionCompilation"/> so that
 /// any container to which the config collection will be applied will use the <see cref="ExpressionCompiler"/>.
 /// </summary>
 /// <param name="combined">The collection to which the behaviour is to be added.</param>
 /// <returns>The collection on which the operation is called, to allow chaining of further calls.</returns>
 public static CombinedContainerConfig UseExpressionCompiler(this CombinedContainerConfig combined)
 {
     return(combined.UseCompiler(ExpressionCompilation.Instance));
 }
Exemplo n.º 3
0
 /// <summary>
 /// Constructs a new instance of the <see cref="CombinedContainerConfig"/> class by cloning an existing one.
 /// </summary>
 /// <param name="collection">The collection whose elements are to be copied.  If null, then the collection is initialised
 /// empty.</param>
 public CombinedContainerConfig(CombinedContainerConfig collection)
     : this((IEnumerable <IContainerConfig>)collection)
 {
 }