Ejemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MutatorDescriptor"/> class.
 /// </summary>
 /// <param name="implementationType">Type of the implementation.</param>
 /// <param name="mutatorFactory">The mutator factory.</param>
 /// <param name="lifetime">The lifetime.</param>
 public MutatorDescriptor(Type implementationType, Func<IServiceProvider, object> mutatorFactory, MutatorLifetime lifetime, string alias = null)
 {
     Alias = alias;
     Lifetime = lifetime;
     ImplementationType = implementationType;
     ImplementationFactory = mutatorFactory;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MutatorDescriptor" /> class.
        /// </summary>
        /// <param name="implementationType">Type of the implementation.</param>
        /// <param name="lifetime">The lifetime.</param>
        /// <param name="alias">The alias.</param>
        public MutatorDescriptor(Type implementationType, MutatorLifetime lifetime, string alias = null)
        {
            if (typeof(IMutator<,>).IsAssignableFrom(implementationType))
            {
                throw new ArgumentException($"The {nameof(implementationType)} was not derived from the IMutator-interface");
            }

            ImplementationType = implementationType;
            Lifetime = lifetime;
            Alias = alias;
        }