Exemplo n.º 1
0
        private void ApplyBackwardCompatibility(DatabaseSmugglerOptionsServerSide options)
        {
            if (options == null)
            {
                return;
            }

            if (RequestRouter.TryGetClientVersion(HttpContext, out var version) == false)
            {
                return;
            }

            if (version.Major != RavenVersionAttribute.Instance.MajorVersion)
            {
                return;
            }

            // only all 4.0 and 4.1 less or equal to 41006
            if (version.Revision < 50 || version.Revision > 41006)
            {
                return;
            }

            if (options.OperateOnTypes.HasFlag(DatabaseItemType.Documents))
            {
                options.OperateOnTypes |= DatabaseItemType.Attachments;
            }
        }
Exemplo n.º 2
0
        private static void CheckVersionAndWrapException(HttpContext context, ref Exception e)
        {
            if (RequestRouter.TryGetClientVersion(context, out var version) == false)
            {
                return;
            }

            if (version.Major == '3')
            {
                e = new ClientVersionMismatchException(
                    $"RavenDB does not support interaction between Client API major version 3 and Server version {RavenVersionAttribute.Instance.MajorVersion} when major version does not match. Client: {version}. " +
                    $"Server: {RavenVersionAttribute.Instance.AssemblyVersion}",
                    e);
            }
            else if (HasInvalidCommandTypeException(e))
            {
                RequestRouter.CheckClientVersionAndWrapException(version, ref e);
            }
Exemplo n.º 3
0
        private void ApplyBackwardCompatibility(DatabaseSmugglerOptionsServerSide options)
        {
            if (options == null)
            {
                return;
            }

            if (((options.OperateOnTypes & DatabaseItemType.DatabaseRecord) != 0) &&
                (options.OperateOnDatabaseRecordTypes == DatabaseRecordItemType.None))
            {
                options.OperateOnDatabaseRecordTypes = DatabaseSmugglerOptions.DefaultOperateOnDatabaseRecordTypes;
            }

            if (RequestRouter.TryGetClientVersion(HttpContext, out var version) == false)
            {
                return;
            }

            if (version.Major != RavenVersionAttribute.Instance.MajorVersion)
            {
                return;
            }

#pragma warning disable 618
            if (version.Minor < 2 && options.OperateOnTypes.HasFlag(DatabaseItemType.Counters))
#pragma warning restore 618
            {
                options.OperateOnTypes |= DatabaseItemType.CounterGroups;
            }

            // only all 4.0 and 4.1 less or equal to 41006
            if (version.Revision < 50 || version.Revision > 41006)
            {
                return;
            }

            if (options.OperateOnTypes.HasFlag(DatabaseItemType.Documents))
            {
                options.OperateOnTypes |= DatabaseItemType.Attachments;
            }
        }