Beispiel #1
0
        internal override void BuildInternal()
        {
            _replaceResponse.FailedDocumentsList.Clear();
            if (FailedDocumentsList != null && FailedDocumentsList.Count > 0)
            {
                IEnumerator <FailedDocument> enu = _failedDocumentsList.GetEnumerator();
                while (enu.MoveNext())
                {
                    Protobuf.FailedDocument.Builder failedDocuments = new Alachisoft.NosDB.Common.Protobuf.FailedDocument.Builder();
                    failedDocuments.SetDocumentId(enu.Current.DocumentKey);
                    failedDocuments.SetErrorCode(enu.Current.ErrorCode);


                    if (enu.Current.ErrorParameters != null)
                    {
                        foreach (var errorParam in enu.Current.ErrorParameters)
                        {
                            failedDocuments.AddErrorParams(errorParam);
                        }
                    }

                    _replaceResponse.FailedDocumentsList.Add(failedDocuments.Build());
                }
            }
            base._response.SetReplaceDocumentsResponse(_replaceResponse);
            base._response.SetType(Alachisoft.NosDB.Common.Protobuf.Response.Types.Type.REPLACE_DOCUMENTS);
        }
Beispiel #2
0
        internal override void BuildInternal()
        {
            _insertResponse.FailedDocumentsList.Clear();
            if (FailedDocumentsList != null && FailedDocumentsList.Count > 0)
            {
                //Alachisoft.NosDB.Common.Protobuf.FailedDocument.Builder failedDocument;
                //failedDocument = new Alachisoft.NosDB.Common.Protobuf.FailedDocument.Builder();


                //IDictionaryEnumerator enu = FailedDocuments.GetEnumerator();
                //while (enu.MoveNext())
                //{
                //    failedDocument = new Alachisoft.NosDB.Common.Protobuf.FailedDocument.Builder();
                //    failedDocument.SetDocumentId((string)enu.Key);
                //    failedDocument.SetErrorCode((int)enu.Value);
                //    failedDocument.SetErrorParams(enu.)
                //    _insertResponse.FailedDocumentsList.Add(failedDocument.Build());
                //}

                IEnumerator <FailedDocument> enumerator = FailedDocumentsList.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    Protobuf.FailedDocument.Builder failedDocuments = new Alachisoft.NosDB.Common.Protobuf.FailedDocument.Builder();
                    failedDocuments.SetDocumentId(enumerator.Current.DocumentKey);
                    failedDocuments.SetErrorCode(enumerator.Current.ErrorCode);

                    if (enumerator.Current.ErrorParameters != null)
                    {
                        foreach (var errorParam in enumerator.Current.ErrorParameters)
                        {
                            failedDocuments.AddErrorParams(errorParam);
                        }
                    }
                    _insertResponse.FailedDocumentsList.Add(failedDocuments.Build());
                }
                //if (_failedDocumentList != null)
                //{
                //    foreach (FailedDocument document in _failedDocumentList)
                //    {
                //        failedDocument = new Alachisoft.NosDB.Common.Protobuf.FailedDocument.Builder();
                //        failedDocument.SetDocumentId(document.DocumentKey.ToJson());
                //        failedDocument.SetErrorCode((int)enu.Value);
                //        //failedDocument.ErrorParameters = document.ErrorParameters
                //        _insertResponse.FailedDocumentsList.Add(failedDocument.Build());
                //    }
                //}
            }
            base._response.SetInsertDocumentsResponse(_insertResponse);
            base._response.SetType(Alachisoft.NosDB.Common.Protobuf.Response.Types.Type.INSERT_DOCUMENTS);
        }