Пример #1
0
        public Document GetDocument(String documentName, String collectionID = "GrpcTestData")
        {
            var getDocumentRequest = new GetDocumentRequest();

            getDocumentRequest.Name = Parent + "/documents/" + collectionID + "/" + documentName;
            Document retDoc;

            try
            {
                retDoc = FsClient.GetDocument(getDocumentRequest);
            }
            catch (Grpc.Core.RpcException e)
            {
                if (e.Status.StatusCode == Grpc.Core.StatusCode.NotFound)
                {
//                    FirestoreTestUtils.ColoredConsoleWrite(ConsoleColor.Red, "ERROR: Document " + documentName + " not found!");
                    throw e;
                }
                else
                {
                    Console.WriteLine("{0} Exception caught.", e);
                }
                throw e;
            }
            catch (Exception e)
            {
                Console.WriteLine("{0} Exception caught.", e);
                throw e;
            }
            return(retDoc);
        }