开发者

RavenDB - Need a simple example using EmbeddableDocumentStore?

I am experimenting with RavenDB embedded in my application. I am receiving a "Type 'EmbeddableDocumentStore' is not defined" error. I do, however, have a reference to Raven.Client.Embedded in my project.

Here's my VB.Net code:

Imports Raven.Client.Client
Imports Raven.Client

Sub Main()
    Dim documentStore As EmbeddableDocumentStore = New EmbeddableDocumentStore()
    documentStore.DataDirectory = "c:\dbdata"
    documentStore.Initialize()

    Dim session As Document.DocumentSession = documentStore.OpenSession()
    session.Store(New LineItem With {
                                        .draftpostingdate = Nothing,
                                        .forumdate = "#12/1/2010#",
                                        .pfvolume = Nothing,
                                        .pfissue = Nothing,
                                        .change = "change",
                                        .sectiontext = "Revision",
                                        .rs = Nothing,
                                        .revisionid = 51438,
                                        .mononum = "100249",
                                        .webtype = "PCA"
                                    })
    session.SaveChanges()

    Dim lineItems = session.Query开发者_JS百科(Of LineItem)()
    For Each li As LineItem In lineItems
        Console.WriteLine(li.mononum)
    Next
End Sub


I have had similar problems before when I targeted the wrong framework. Have you checked that you're not targeting the "Client Profile" in your project? If I remember correctly you have to target the full framework when using Embedded client.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜