RavenDB - 需要一个使用EmbeddableDocumentStore的简单示例吗?

时间:2011-01-20 17:19:29

标签: vb.net ravendb

我正在试验我的应用程序中嵌入的RavenDB。我收到“类型'EmbeddableDocumentStore'未定义”错误。但是,我在项目中引用了 Raven.Client.Embedded

这是我的VB.Net代码:

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(Of LineItem)()
    For Each li As LineItem In lineItems
        Console.WriteLine(li.mononum)
    Next
End Sub

1 个答案:

答案 0 :(得分:4)

在我定位错误的框架之前,我遇到过类似的问题。您是否检查过您的目标是否未定位到项目中的“客户资料”?如果我没记错的话,你必须在使用嵌入式客户端时定位完整的框架。

相关问题