本文整理汇总了C#中Raven.Client.Embedded.EmbeddableDocumentStore.ExecuteIndex方法的典型用法代码示例。如果您正苦于以下问题:C# EmbeddableDocumentStore.ExecuteIndex方法的具体用法?C# EmbeddableDocumentStore.ExecuteIndex怎么用?C# EmbeddableDocumentStore.ExecuteIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Raven.Client.Embedded.EmbeddableDocumentStore
的用法示例。
在下文中一共展示了EmbeddableDocumentStore.ExecuteIndex方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Create
public ITimeoutManager Create()
{
_documentStore = new EmbeddableDocumentStore()
{
RunInMemory = true,
};
_documentStore.Configuration.Storage.Voron.AllowOn32Bits = true;
_documentStore.Initialize();
_documentStore.ExecuteIndex(new TimeoutIndex());
return new RavenDbTimeoutManager(_documentStore, new ConsoleLoggerFactory(false));
}
示例2: ConfigureRaven
public static void ConfigureRaven(MvcApplication application)
{
var store = new EmbeddableDocumentStore
{
DataDirectory = "~/App_Data/Database",
UseEmbeddedHttpServer = true
};
store.Conventions.CustomizeJsonSerializer = x => x.Converters.Add(new GeoJsonConverter());
store.Initialize();
MvcApplication.DocumentStore = store;
store.ExecuteIndex(new RestaurantIndex());
store.ExecuteTransformer(new RestaurantsTransformer());
var statistics = store.DatabaseCommands.GetStatistics();
if (statistics.CountOfDocuments < 5)
using (var bulkInsert = store.BulkInsert())
LoadRestaurants(application.Server.MapPath("~/App_Data/Restaurants.csv"), bulkInsert);
}
示例3: Init
public void Init()
{
Directory.CreateDirectory(Settings.DbPath);
var documentStore = new EmbeddableDocumentStore
{
DataDirectory = Settings.DbPath,
UseEmbeddedHttpServer = Settings.MaintenanceMode || Settings.ExposeRavenDB,
EnlistInDistributedTransactions = false,
};
var localRavenLicense = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "RavenLicense.xml");
if (File.Exists(localRavenLicense))
{
Logger.InfoFormat("Loading RavenDB license found from {0}", localRavenLicense);
documentStore.Configuration.Settings["Raven/License"] = NonLockingFileReader.ReadAllTextWithoutLocking(localRavenLicense);
}
else
{
Logger.InfoFormat("Loading Embedded RavenDB license");
documentStore.Configuration.Settings["Raven/License"] = ReadLicense();
}
documentStore.Configuration.Catalog.Catalogs.Add(new AssemblyCatalog(GetType().Assembly));
if (!Settings.MaintenanceMode) {
documentStore.Configuration.Settings.Add("Raven/ActiveBundles", "CustomDocumentExpiration");
}
documentStore.Configuration.Port = Settings.Port;
documentStore.Configuration.HostName = (Settings.Hostname == "*" || Settings.Hostname == "+")
? "localhost"
: Settings.Hostname;
documentStore.Configuration.CompiledIndexCacheDirectory = Settings.DbPath;
documentStore.Configuration.VirtualDirectory = Settings.VirtualDirectory + "/storage";
documentStore.Conventions.SaveEnumsAsIntegers = true;
documentStore.Initialize();
Logger.Info("Index creation started");
//Create this index synchronously as we are using it straight away
//Should be quick as number of endpoints will always be a small number
documentStore.ExecuteIndex(new KnownEndpointIndex());
if (Settings.CreateIndexSync)
{
IndexCreation.CreateIndexes(typeof(RavenBootstrapper).Assembly, documentStore);
}
else
{
IndexCreation.CreateIndexesAsync(typeof(RavenBootstrapper).Assembly, documentStore)
.ContinueWith(c =>
{
if (c.IsFaulted)
{
Logger.Error("Index creation failed", c.Exception);
}
});
}
PurgeKnownEndpointsWithTemporaryIdsThatAreDuplicate(documentStore);
Configure.Instance.Configurer.RegisterSingleton<IDocumentStore>(documentStore);
Configure.Component(builder =>
{
#pragma warning disable 618
var context = builder.Build<PipelineExecutor>().CurrentContext;
#pragma warning restore 618
IDocumentSession session;
if (context.TryGet(out session))
{
return session;
}
throw new InvalidOperationException("No session available");
}, DependencyLifecycle.InstancePerCall);
Configure.Instance.RavenDBStorageWithSelfManagedSession(documentStore, false,
() => Configure.Instance.Builder.Build<IDocumentSession>())
.UseRavenDBSagaStorage()
.UseRavenDBSubscriptionStorage()
.UseRavenDBTimeoutStorage();
}