本文整理汇总了C#中Raven.Client.Document.DocumentStore.ExecuteIndex方法的典型用法代码示例。如果您正苦于以下问题:C# DocumentStore.ExecuteIndex方法的具体用法?C# DocumentStore.ExecuteIndex怎么用?C# DocumentStore.ExecuteIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Raven.Client.Document.DocumentStore
的用法示例。
在下文中一共展示了DocumentStore.ExecuteIndex方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateDatabaseWithReplication
private static void CreateDatabaseWithReplication(string databaseName, IDocumentStore store)
{
store.DatabaseCommands.GlobalAdmin.CreateDatabase(new DatabaseDocument
{
Id = databaseName,
Settings = new Dictionary<string, string>
{
{
"Raven/ActiveBundles", "Replication"
},
{
"Raven/DataDir", "~/" + databaseName
}
}
});
using (var newStore = new DocumentStore
{
Url = store.Url,
DefaultDatabase = databaseName
}.Initialize())
{
newStore.ExecuteIndex(new RavenDocumentsByEntityName());
}
}
示例2: Main
static void Main(string[] args)
{
var store = new DocumentStore
{
Url = (args.Length == 1 ? args[0] : "http://localhost:33333/storage"),
};
store.Initialize();
store.Conventions.MaxNumberOfRequestsPerSession = 2048;
Console.WriteLine("This tool is going to examine ServiceControl for potential messages affected by issue https://github.com/Particular/ServiceControl/pull/558\n");
Console.WriteLine("Creating Temp Index (this may take some time)...");
var index = new MessageHistories();
try
{
store.ExecuteIndex(index);
while (store.DatabaseCommands.GetStatistics().StaleIndexes.Length != 0)
{
Thread.Sleep(10);
}
Console.WriteLine(" DONE");
Console.WriteLine("\nScanning for messages that were sent for reprocessing and require your attention.\n");
var dangerLevel = CheckForMessagesAffectedByIssue(store);
var noralColor = Console.ForegroundColor;
Console.ForegroundColor = ConsoleColor.Cyan;
switch (dangerLevel)
{
case 0: // Not affected
Console.WriteLine("You are NOT affected by issue https://github.com/Particular/ServiceControl/pull/558");
Console.WriteLine("However, we ask all users of ServiceControl using 1.6.x to update to the latest version immediately.");
Console.WriteLine("Latest release: https://github.com/Particular/ServiceControl/releases");
break;
case 1: // Maybe affected
Console.WriteLine("You may be affected by issue https://github.com/Particular/ServiceControl/pull/558");
Console.WriteLine("Please upgrade ServiceControl to the latest version immediately.");
Console.WriteLine("Latest release: https://github.com/Particular/ServiceControl/releases");
Console.WriteLine("Contact us via support (http://particular.net/support) and we will work with you to get your situation sorted out.");
break;
case 2: // Definitely affected
Console.WriteLine("You are affected by issue https://github.com/Particular/ServiceControl/pull/558");
Console.WriteLine("Please upgrade ServiceControl to the latest version immediately.");
Console.WriteLine("Latest release: https://github.com/Particular/ServiceControl/releases");
Console.WriteLine("Contact us via support (http://particular.net/support) and we will work with you to get your situation sorted out.");
break;
}
Console.ForegroundColor = noralColor;
}
finally
{
Console.WriteLine("\nRemoving Temp Index...");
Console.WriteLine(" DONE");
store.DatabaseCommands.DeleteIndex(index.IndexName);
}
}