Beispiel #1
0
        /// <summary>
        /// Creates an instance with the <see cref="SourceResolver"/>.
        /// Allows to resolve dependencies if the factory is overridden with an IoC Container.
        /// </summary>
        /// <param name="sourceType">The source type</param>
        /// <returns>The instance created</returns>
        public static object CreateNew(Type sourceType)
        {
            var source = SourceResolver.CreateInstance(sourceType);

            return(source);
        }
Beispiel #2
0
        /// <summary>
        /// Creates a new instance with the <see cref="SourceResolver"/> factory.
        /// </summary>
        /// <param name="implementationType">The implementation type</param>
        /// <returns></returns>
        public T CreateNew(Type implementationType)
        {
            var item = SourceResolver.CreateInstance(implementationType);

            return((T)item);
        }
Beispiel #3
0
        /// <summary>
        /// Creates a new instance with the <see cref="SourceResolver"/> factory.
        /// </summary>
        /// <returns>The instance created</returns>
        public T CreateNew()
        {
            var item = SourceResolver.CreateInstance(typeof(T));

            return((T)item);
        }
Beispiel #4
0
        /// <summary>
        /// Creates a new instance with the <see cref="SourceResolver"/> factory.
        /// </summary>
        /// <typeparam name="TImplementation">The implementation type</typeparam>
        /// <returns>The instance created</returns>
        public T CreateNew <TImplementation>() where TImplementation : T
        {
            var item = SourceResolver.CreateInstance(typeof(TImplementation));

            return((T)item);
        }
        /// <summary>
        /// Creates an instance with the <see cref="SourceResolver"/>. Allows to inject dependencies if the factory is overridden with an IoC Container.
        /// </summary>
        /// <param name="itemType">The item type</param>
        /// <returns>The item created</returns>
        public virtual object CreateNew(Type itemType)
        {
            var item = SourceResolver.CreateInstance(itemType);

            return(item);
        }