コード例 #1
0
        public override IDBResponse CreateResponse()
        {
            CreateSessionResponse response = new CreateSessionResponse();

            response.RequestId = base.RequestId;
            return(response);
        }
コード例 #2
0
        public object Deserialize(byte[] buffer)
        {
            //deseralize
            IDBResponse dbResponse = null;

            try
            {
                Response response = Response.ParseFrom(buffer);

                if (response != null)
                {
                    switch (response.Type)
                    {
                    case Response.Types.Type.INSERT_DOCUMENTS:
                        dbResponse = new Alachisoft.NosDB.Common.Server.Engine.Impl.InsertDocumentsResponse(response);
                        break;

                    case Response.Types.Type.GET_DOCUMENTS:
                        dbResponse = new Alachisoft.NosDB.Common.Server.Engine.Impl.GetDocumentsResponse(response);
                        break;

                    case Response.Types.Type.DELETE_DOCUMENTS:
                        dbResponse = new Alachisoft.NosDB.Common.Server.Engine.Impl.DeleteDocumentsResponse(response);
                        break;

                    case Response.Types.Type.UPDATE:
                        dbResponse = new Alachisoft.NosDB.Common.Server.Engine.Impl.UpdateResponse(response);
                        break;

                    case Response.Types.Type.WRITE_QUERY:
                        dbResponse = new Alachisoft.NosDB.Common.Server.Engine.Impl.WriteQueryResponse(response);
                        break;

                    case Response.Types.Type.READ_QUERY:
                        dbResponse = new Alachisoft.NosDB.Common.Server.Engine.Impl.ReadQueryResponse(response);
                        break;

                    case Response.Types.Type.CREATE_SESSION:
                        dbResponse = new Alachisoft.NosDB.Common.Server.Engine.Impl.CreateSessionResponse(response);
                        break;

                    case Response.Types.Type.GET_CHUNK:
                        dbResponse = new Alachisoft.NosDB.Common.Server.Engine.Impl.GetChunkResponse(response);
                        break;

                    case Response.Types.Type.DISPOSE_READER:
                        dbResponse = new DatabaseResponse(response.ToBuilder());
                        break;

                    case Response.Types.Type.REPLACE_DOCUMENTS:
                        dbResponse = new Alachisoft.NosDB.Common.Server.Engine.Impl.ReplaceDocumentsResponse(response);
                        break;

                    case Response.Types.Type.AUTHENTICATION:
                        dbResponse = new Alachisoft.NosDB.Common.Server.Engine.Impl.AuthenticationResponse(response);
                        break;

                    case Response.Types.Type.INIT_DATABASE:
                        dbResponse = new Alachisoft.NosDB.Common.Server.Engine.Impl.InitDatabaseResponse(response);
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error: Deserialize Response on client Side : " + ex);
                throw;
            }

            return(dbResponse);
        }