Hi,
I’m having headache porting CS code into Basic in order to do trivial getdoc/insert into a bucket.
My bucket contains JSON docs and blobs. Because of those “variant” format, i’m not sure how to cast the document for the IBucket. In my current code, vs complains about unable to cast system.string into the “fichier” IDocumentResult
Any idea to circumvent/fix that ?
note : i’m not used of Interfaces in VB.
Imports Couchbase.Annotations
Imports Couchbase.Core
Imports Couchbase.Core.Buckets
Namespace CouchbaseVB.Grabber
Public Class fichier
Public dataset As Object
End Class
Public Class CBlinker
Private UsedBucketName As String
Private MyCouch As Couchbase.Cluster = New Couchbase.Cluster()
Private MyBucket As IBucket
Public Sub Open(bucketname As String)
UsedBucketName = bucketname
MyBucket = MyCouch.OpenBucket(bucketname)
End Sub
Public Sub Close()
If MyCouch.IsOpen(UsedBucketName) Then
MyCouch.CloseBucket(MyBucket)
End If
End Sub
Public Function GetDoc(docid As String) As Object
Dim tmp As Object
tmp = MyBucket.GetDocument(Of fichier)(docid)
If tmp.Success Then
Return tmp.Value.dataset
Else
Return tmp.Message
End If
End Function
End Class
End Namespace