コード例 #1
0
        /// <summary>
        /// Determines whether the specified version is equal to or above the connected Dynamics 365 version.
        /// </summary>
        /// <param name="version">The version to compare.</param>
        /// <returns>True if the specified version is equal to or above the connected Dynamics 365 version, false otherwise.</returns>
        public bool IsVersionOrAbove(CrmVersion version)
        {
            bool result = false;

            if (Version != null && Version.Major >= (int)version)
            {
                result = true;
            }

            return(result);
        }
コード例 #2
0
        public static bool IsSupported(CrmVersion requiredVersion)
        {
            var orgVersion     = CrmContext.Version;
            var orgVersionEnum = GetCrmVersionConstant(orgVersion);
            var sdkVersionEnum = GetSdkVersionConstant(_sdkVersion);

            if (orgVersionEnum != CrmVersion.Unknown && sdkVersionEnum != CrmVersion.Unknown)
            {
                var minVersionEnum = (CrmVersion)Math.Min((int)orgVersionEnum, (int)sdkVersionEnum);
                return(minVersionEnum >= requiredVersion);
            }
            else if (orgVersionEnum != CrmVersion.Unknown)
            {
                return(orgVersionEnum >= requiredVersion);
            }
            else if (sdkVersionEnum != CrmVersion.Unknown)
            {
                return(sdkVersionEnum >= requiredVersion);
            }
            else
            {
                return(false);
            }
        }