本文整理汇总了C#中Raven.Database.DocumentDatabase.SpinBackgroundWorkers方法的典型用法代码示例。如果您正苦于以下问题:C# DocumentDatabase.SpinBackgroundWorkers方法的具体用法?C# DocumentDatabase.SpinBackgroundWorkers怎么用?C# DocumentDatabase.SpinBackgroundWorkers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Raven.Database.DocumentDatabase
的用法示例。
在下文中一共展示了DocumentDatabase.SpinBackgroundWorkers方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RavenDbServer
public RavenDbServer(RavenConfiguration settings)
{
settings.LoadLoggingSettings();
if (settings.ShouldCreateDefaultsWhenBuildingNewDatabaseFromScratch)
settings.DatabaseCreatedFromScratch += OnDatabaseCreatedFromScratch;
database = new DocumentDatabase(settings);
database.SpinBackgroundWorkers();
server = new HttpServer(settings,
typeof (RequestResponder).Assembly.GetTypes()
.Where(
t => typeof (RequestResponder).IsAssignableFrom(t) && t.IsAbstract == false)
// to ensure that we would get consistent order, so we would always
// have the responders using the same order, otherwise we get possibly
// random ordering, and that might cause issues
.OrderBy(x => x.Name)
.Select(t => (RequestResponder) Activator.CreateInstance(t))
.Select(r =>
{
r.Database = database;
r.Settings = settings;
return r;
})
);
server.Start();
}
示例2: Init
public static void Init()
{
if (database != null)
return;
lock (locker)
{
if (database != null)
return;
try
{
var ravenConfiguration = new RavenConfiguration();
if (RoleEnvironment.IsAvailable)
{
ravenConfiguration.RunInMemory = true;
// Mount Cloud drive and set it as Data Directory
//var currentConfiguredRavenDataDir = ConfigurationManager.AppSettings["Raven/DataDir"] ?? string.Empty;
//string azureDrive = @"D:\"; // Environment.GetEnvironmentVariable(RavenDriveConfiguration.AzureDriveEnvironmentVariableName, EnvironmentVariableTarget.Machine);
//if (string.IsNullOrWhiteSpace(azureDrive))
//{
// throw new ArgumentException("RavenDb drive environment variable is not yet set by worker role. Please, retry in a couple of seconds");
//}
//string azurePath = Path.Combine(azureDrive,
// currentConfiguredRavenDataDir.StartsWith(@"~\")
// ? currentConfiguredRavenDataDir.Substring(2)
// : "Data");
//ravenConfiguration.DataDirectory = azurePath;
// Read port number specified for this Raven instance and set it in configuration
var endpoint = RoleEnvironment.CurrentRoleInstance.InstanceEndpoints["Raven"];
ravenConfiguration.Port = endpoint.IPEndpoint.Port;
// When mounting drives in emulator only Munin storage is supported, since drive is not actually present and low level access to it failes (Esent mode)
}
HttpEndpointRegistration.RegisterHttpEndpointTarget();
database = new DocumentDatabase(ravenConfiguration);
database.SpinBackgroundWorkers();
server = new HttpServer(ravenConfiguration, database);
server.Init();
}
catch
{
if (database != null)
{
database.Dispose();
database = null;
}
if (server != null)
{
server.Dispose();
server = null;
}
throw;
}
HostingEnvironment.RegisterObject(new ReleaseRavenDBWhenAppDomainIsTornDown());
}
}
示例3: AfterBackupRestoreCanQueryIndex_CreatedAfterRestore
public void AfterBackupRestoreCanQueryIndex_CreatedAfterRestore()
{
db.Put("ayende", null, RavenJObject.Parse("{'email':'[email protected]'}"), RavenJObject.Parse("{'Raven-Entity-Name':'Users'}"), null);
db.StartBackup(BackupDir, false, new DatabaseDocument());
WaitForBackup(db, true);
db.Dispose();
IOExtensions.DeleteDirectory(DataDir);
DocumentDatabase.Restore(new RavenConfiguration(), BackupDir, DataDir, s => { }, defrag: true);
db = new DocumentDatabase(new RavenConfiguration { DataDirectory = DataDir });
db.SpinBackgroundWorkers();
QueryResult queryResult;
do
{
queryResult = db.Query("Raven/DocumentsByEntityName", new IndexQuery
{
Query = "Tag:[[Users]]",
PageSize = 10
}, CancellationToken.None);
} while (queryResult.IsStale);
Assert.Equal(1, queryResult.Results.Count);
}
示例4: Init
public static void Init()
{
if (database != null)
return;
lock (locker)
{
if (database != null)
return;
try
{
var ravenConfiguration = new RavenConfiguration();
HttpEndpointRegistration.RegisterHttpEndpointTarget();
database = new DocumentDatabase(ravenConfiguration);
database.SpinBackgroundWorkers();
server = new HttpServer(ravenConfiguration, database);
server.Init();
}
catch
{
if (database != null)
{
database.Dispose();
database = null;
}
if (server != null)
{
server.Dispose();
server = null;
}
throw;
}
}
}
示例5: AfterBackupRestoreCanQueryIndex_CreatedAfterRestore
public void AfterBackupRestoreCanQueryIndex_CreatedAfterRestore()
{
db.Put("ayende", null, JObject.Parse("{'email':'[email protected]'}"), JObject.Parse("{'Raven-Entity-Name':'Users'}"), null);
db.StartBackup("raven.db.test.backup");
WaitForBackup();
db.Dispose();
DeleteIfExists("raven.db.test.esent");
DocumentDatabase.Restore(new RavenConfiguration(), "raven.db.test.backup", "raven.db.test.esent");
db = new DocumentDatabase(new RavenConfiguration { DataDirectory = "raven.db.test.esent" });
db.SpinBackgroundWorkers();
QueryResult queryResult;
do
{
queryResult = db.Query("Raven/DocumentsByEntityName", new IndexQuery
{
Query = "Tag:[[Users]]",
PageSize = 10
});
} while (queryResult.IsStale);
Assert.Equal(1, queryResult.Results.Count);
}
示例6: RavenDbServer
public RavenDbServer(RavenConfiguration settings)
{
settings.LoadLoggingSettings();
database = new DocumentDatabase(settings);
database.SpinBackgroundWorkers();
server = new HttpServer(settings, database);
server.Start();
}
示例7: SpatialIndexTest
public SpatialIndexTest()
{
db = new DocumentDatabase(new RavenConfiguration
{
RunInMemory = true
});
db.SpinBackgroundWorkers();
}
示例8: ParameterisedDynamicQuery
public ParameterisedDynamicQuery()
{
db = new DocumentDatabase(new RavenConfiguration
{
DataDirectory = "raven.db.test.esent",
});
db.SpinBackgroundWorkers();
}
示例9: SpatialIndex
public SpatialIndex()
{
db = new DocumentDatabase(new RavenConfiguration
{
DataDirectory = "raven.db.test.esent",
RunInUnreliableYetFastModeThatIsNotSuitableForProduction = true
});
db.SpinBackgroundWorkers();
}
示例10: ComplexIndexOnNotAnalyzedField
public ComplexIndexOnNotAnalyzedField()
{
db = new DocumentDatabase(new RavenConfiguration
{
DataDirectory = DataDir,
RunInUnreliableYetFastModeThatIsNotSuitableForProduction = true
});
db.SpinBackgroundWorkers();
}
示例11: MapReduce
public MapReduce()
{
db = new DocumentDatabase(new RavenConfiguration
{
DataDirectory = DataDir,
RunInUnreliableYetFastModeThatIsNotSuitableForProduction = true
});
db.PutIndex("CommentsCountPerBlog", new IndexDefinition{Map = map, Reduce = reduce, Indexes = {{"blog_id", FieldIndexing.NotAnalyzed}}});
db.SpinBackgroundWorkers();
}
示例12: CompiledIndex
public CompiledIndex()
{
db = new DocumentDatabase(new RavenConfiguration
{
DataDirectory = "raven.db.test.esent",
RunInUnreliableYetFastModeThatIsNotSuitableForProduction = true,
Catalog = { Catalogs = { new TypeCatalog(typeof(ShoppingCartEventsToShopingCart), typeof(MapOnlyView)) } }
});
db.SpinBackgroundWorkers();
}
示例13: IndexTriggers
public IndexTriggers()
{
db = new DocumentDatabase(new RavenConfiguration
{
DataDirectory = "raven.db.test.esent",
Container = new CompositionContainer(new TypeCatalog(
typeof(IndexToDataTable))),
RunInUnreliableYetFastModeThatIsNotSuitableForProduction = true
});
db.SpinBackgroundWorkers();
}
示例14: ForwardToRavenRespondersFactory
static ForwardToRavenRespondersFactory()
{
lock (locker)
{
if (database != null)
return;
database = new DocumentDatabase(ravenConfiguration);
database.SpinBackgroundWorkers();
server = new RavenDbHttpServer(ravenConfiguration, database);
}
}
示例15: MapReduce
public MapReduce()
{
db = new DocumentDatabase(new RavenConfiguration {DataDirectory = "raven.db.test.esent"});
db.PutIndex("CommentsCountPerBlog", new IndexDefinition{Map = map, Reduce = reduce, Indexes = {{"blog_id", FieldIndexing.Untokenized}}});
db.SpinBackgroundWorkers();
BasicConfigurator.Configure(
new OutputDebugStringAppender
{
Layout = new SimpleLayout()
});
}