Exemplo n.º 1
0
        public static DatabaseOperationType MapOperationType(Protobuf.Command.Types.Type operationTypeArg)
        {
            DatabaseOperationType operatinType = DatabaseOperationType.Insert;

            switch (operationTypeArg)
            {
            case Protobuf.Command.Types.Type.INSERT_DOCUMENTS:
                operatinType = DatabaseOperationType.Insert;
                break;

            case Protobuf.Command.Types.Type.DELETE_DOCUMENTS:
                operatinType = DatabaseOperationType.Delete;
                break;

            case Protobuf.Command.Types.Type.GET_DOCUMENTS:
                operatinType = DatabaseOperationType.Get;
                break;

            case Protobuf.Command.Types.Type.UPDATE:
                operatinType = DatabaseOperationType.Update;
                break;

            case Protobuf.Command.Types.Type.READ_QUERY:
                operatinType = DatabaseOperationType.ReadQuery;
                break;

            case Protobuf.Command.Types.Type.WRITE_QUERY:
                operatinType = DatabaseOperationType.WriteQuery;
                break;

            case Protobuf.Command.Types.Type.GET_CHUNK:
                operatinType = DatabaseOperationType.GetChunk;
                break;

            case Protobuf.Command.Types.Type.DISPOSE_READER:
                operatinType = DatabaseOperationType.DisposeReader;
                break;

            case Protobuf.Command.Types.Type.REPLACE_DOCUMENTS:
                operatinType = DatabaseOperationType.Replace;
                break;

            case Protobuf.Command.Types.Type.AUTHENTICATION:
                operatinType = DatabaseOperationType.Authenticate;
                break;

            case Protobuf.Command.Types.Type.INIT_DATABASE:
                operatinType = DatabaseOperationType.Init;
                break;

            default:
                throw new ArgumentOutOfRangeException("Operation " + operationTypeArg + " not supported");
            }
            return(operatinType);
        }
Exemplo n.º 2
0
        public static Protobuf.Command.Types.Type MapOperationType(DatabaseOperationType operationTypeArg)
        {
            Protobuf.Command.Types.Type protoOperationType = Protobuf.Command.Types.Type.INSERT_DOCUMENTS;
            switch (operationTypeArg)
            {
            case DatabaseOperationType.Init:
                protoOperationType = Protobuf.Command.Types.Type.INIT_DATABASE;
                break;

            case DatabaseOperationType.Insert:
                protoOperationType = Protobuf.Command.Types.Type.INSERT_DOCUMENTS;
                break;

            case DatabaseOperationType.Delete:
                protoOperationType = Protobuf.Command.Types.Type.DELETE_DOCUMENTS;
                break;

            case DatabaseOperationType.Get:
                protoOperationType = Protobuf.Command.Types.Type.GET_DOCUMENTS;
                break;

            case DatabaseOperationType.Replace:
                protoOperationType = Protobuf.Command.Types.Type.REPLACE_DOCUMENTS;
                break;

            case DatabaseOperationType.ReadQuery:
                protoOperationType = Protobuf.Command.Types.Type.READ_QUERY;
                break;

            case DatabaseOperationType.WriteQuery:
                protoOperationType = Protobuf.Command.Types.Type.WRITE_QUERY;
                break;

            case DatabaseOperationType.GetChunk:
                protoOperationType = Protobuf.Command.Types.Type.GET_CHUNK;
                break;

            case DatabaseOperationType.DisposeReader:
                protoOperationType = Protobuf.Command.Types.Type.DISPOSE_READER;
                break;

            default:
                throw new ArgumentOutOfRangeException("Opration " + operationTypeArg + " not supported");
            }
            return(protoOperationType);
        }