I'm trying to use the Versioning bundle in RavenDB embedded but I can't seem to query the revisions.
I'm initializing the database with this code in Global.asax.cs
// Initialise RavenDB embedded
Store = new EmbeddableDocumentStore
{
DataDirectory = "~/App_Data",
UseEmbeddedHttpServer = true,
};
Store.ActivateBundle("Versioning");
Store.Initialize();
The ActivateBundle method is an extension method: (from this question)
public static void ActivateBundle(this EmbeddableDocumentStore documentStore, string bundleName)
{
var settings = documentStore.Configuration.Settings;
var activeBundles = settings[Constants.ActiveBundles];
if (string.IsNullOrEmpty(activeBundles))
settings[Constants.ActiveBundles] = bundleName;
else if (!activeBundles.Split(';').Contains(bundleName, StringComparer.OrdinalIgnoreCase))
settings[Constants.ActiveBundles] = activeBundles + ";" + bundleName;
}
I'm querying for the revisions with this code:
public IList<FormRevision> GetRevisions(Guid formId)
{
using (var session = MvcApplication.Store.OpenSession())
{
var revisions = session.Advanced.GetRevisionsFor<Form>(formId.ToString(), 0, 10);
return revisions.Select(formRevision => session.Advanced.GetMetadataFor(formRevision)).Select(metadata => new FormRevision
{
FormId = formId,
RevisionNumber = metadata.Value<int>("Raven-Document-Revision"),
RevisionDateTime = metadata.Value<DateTime>("Last-Modified")
}).ToList();
}
}
The GetRevisionsFor method is not returning any data.