How to read all record from a model into RavenDB using VB.net?

Rajnilari2015
Posted by Rajnilari2015 under VB.NET category on | Points: 40 | Views : 234
Let's say we have a model as under

Public Class RSS
Public Property Id() As String
Get
Return m_Id
End Get
Set
m_Id = Value
End Set
End Property
Private m_Id As String
Public Property QuestionID() As String
Get
Return m_QuestionID
End Get
Set
m_QuestionID = Value
End Set
End Property
Private m_QuestionID As String
Public Property QuestionTitle() As String
Get
Return m_QuestionTitle
End Get
Set
m_QuestionTitle = Value
End Set
End Property
Private m_QuestionTitle As String
Public Property QuestionDescription() As String
Get
Return m_QuestionDescription
End Get
Set
m_QuestionDescription = Value
End Set
End Property
Private m_QuestionDescription As String
Public Property PublishDate() As DateTime
Get
Return m_PublishDate
End Get
Set
m_PublishDate = Value
End Set
End Property
Private m_PublishDate As DateTime
End Class


The below piece of code will read data from from RSS model to RavenDB

Public Function ReadRssFeed(lstIDs As IEnumerable(Of String)) As List(Of RSS)
Dim rssCollection = New List(Of RSS)()
Using ds = New DocumentStore() With { _
Key .Url = "http://localhost:8080", _
Key .DefaultDatabase = "CRUDDemo" _
}.Initialize()
Using session = ds.OpenSession()
For Each id As var In lstIDs
rssCollection.Add(session.Load(Of RSS)(id))
Next
End Using
End Using
Return rssCollection
End Function

Comments or Responses

Login to post response