Exemple #1
0
        private static void EnsureCanConnect(Type sourceFilter, Type sourceOutputDataType, Type targetFilter, Type targetInputDataType)
        {
            bool canAssign = TypeCompatibilityHelper.CanAssign(sourceOutputDataType, targetInputDataType);

            if (canAssign == false)
            {
                throw new FilterTypeMismatchException($"Mismatch in data types between filters [{sourceFilter.FullName}] and [{targetFilter.FullName}]: Source type [{sourceOutputDataType.FullName}] does not match the expected type [{targetInputDataType.FullName}].");
            }
        }
Exemple #2
0
        private bool TryOverrideDataType(Type baseType, Type specificType, out Type result)
        {
            if (specificType == null)
            {
                result = baseType;
                return(false);
            }

            if (baseType == null || TypeCompatibilityHelper.CanAssign(specificType, baseType))
            {
                result = specificType;
                return(true);
            }

            throw new ArgumentException($"Specific type [{specificType.FullName}] cannot override the base type [{baseType.FullName}].");
        }