Esempio n. 1
0
        /// <summary>
        /// Creates an instance of T from the specified typeName, and ensures it implements the required interface type.
        /// </summary>
        /// <typeparam name="T">Type of class to return.</typeparam>
        /// <param name="typeName">Name of the type to try and load.</param>
        /// <param name="requiredInterfaceTypeName">Name of the required interface that type must implement.</param>
        /// <returns>
        /// Null if the object could not be loaded.
        /// </returns>
        internal static T CreateInstanceWithRequiredInterface <T>(string typeName, string requiredInterfaceTypeName) where T : class
        {
            ITypeActivator typeActivator = typeResolver.GetTypeActivator(typeName);

            return(typeActivator.CreateInstanceWithRequiredInterface <T>(typeName, requiredInterfaceTypeName));
        }