2

ここからサンプル mvc アプリケーションをダウンロードしましたhttp://ravenmvc.codeplex.com/releases/view/45994

それはうまく動作します。しかし、質問があります。サンプル アプリケーション DocumentId では "categories-2" のように見えますが、私のアプリケーションでは Store メソッドを呼び出した後:

        using (var session = DocumentStore.OpenSession())
        {
            session.Store(item);
            session.SaveChanges();
            return item;
        }

「projects/3073」のような DocumentId があります。サンプル アプリケーションと同じ形式で DocumentId を使用したいと考えています。どうすればそれができますか?変更すべきオプションはありますか?

4

1 に答える 1

4

DocumentStoreを初期化するときに、DocumentConventionを設定する必要があります。

var ds = new DocumentStore();
ds.ConnectionStringName = connectionStringName;
ds.Initialize();
ds.Conventions.IdentityPartsSeparator = "-";
于 2010-12-12T13:18:22.187 に答える