質問

Ravendb 「組み込み」モードで実行する機能があります。これは、私が理解する限り、共有ホスティング環境で実行できるようにする必要があります。

ASP.NET MVCアプリケーションでそれがどのように機能するか、そしてそれを行うためのベストプラクティスはどのように機能するかを誰もが考えていますか?

ホスティング環境に私が認識する必要がある依存関係はありますか?

役に立ちましたか?

解決

はい。

共有ホスティング環境でRavendBを実行しています、 http://www.winhost.com/, 、ASP.NET MVC 3とRavendB 1.0.0.371を使用して、2011年7月頃にリリースされました。

私のコード:

public static class Store
{
    private static IDocumentStore store = createStore();

    private static EmbeddableDocumentStore createStore()
    {
        var returnStore = new EmbeddableDocumentStore();
        returnStore.DataDirectory = @"./PersistedData";
        returnStore.Initialize();
        return returnStore;
    }

    public static xxx Read(string key)
    {
        using (var session = store.OpenSession())
        {

            var anEntity = session.Query<xxx>().
                Where(item => item.key == key).Single();
            return anEntity;
        }
    }

    public static void Write(xxx)
    {
        using (var session = store.OpenSession())
        {
            session.Store(xxx);
            session.SaveChanges();
        }
    }
}

これまでのところ唯一の欠点は、Ravendb Management Studioを手に入れないことです。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top