RavenHQ is a cloudy solution for RavenDB. And it has a free option to try it out. So I did.
First you create an account and then you add a database.
To make a database you just fill in the database name and and click on the red add button for the bronze plan.
And when you now go to databases you will see this.
Before we go on with our coding we need to know our connection details. These can be found when you click on the manage button for your database and then connectionstrings.
Now that we got this we just need our Model.
vbnet
Public Class Dvd
Public Property Title As String
End Class
First thing to then do is, is to make a connection.
Which we do like this.
vbnet
Dim documentStore = New DocumentStore() With {.Url = "https://1.ravenhq.com/databases/chrissie1-DVD", .ApiKey = "theapikeygoeshere"}
documentStore.Initialize()
And then we can save a document to the database.
vbnet
Dim session = documentStore.OpenSession()
session.Store(New Dvd With {.Title = "Star Trek 11"})
session.SaveChanges()
Once you have a few document in the database you can query them.
Here I’m gonna do a bad thing and show them all on the screen.
vbnet
Dim dvds = session.Query(Of Dvd)()
Console.WriteLine("Loading Dvds")
For Each Dvd In dvds
Console.WriteLine(session.Advanced.GetDocumentId(Dvd))
Console.WriteLine(Dvd.Title)
Next
Console.WriteLine("Dvds loaded")
Console.ReadLine()
As you can see my model does not have an id but RavenDb still made one for me. I could have added and Id property to my model and then RavenDb would have used that.
You can also see those documents in ravenHQ by going to the Management studio, the url for that can be found under the database info section.
The management studio will then let you view, edit, add and delete documents and much more.
Go check it out and have fun.