本文整理汇总了C#中RavenConfiguration类的典型用法代码示例。如果您正苦于以下问题:C# RavenConfiguration类的具体用法?C# RavenConfiguration怎么用?C# RavenConfiguration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RavenConfiguration类属于命名空间,在下文中一共展示了RavenConfiguration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HttpListenerContextAdpater
public HttpListenerContextAdpater(HttpListenerContext ctx, RavenConfiguration configuration)
{
this.ctx = ctx;
this.configuration = configuration;
Request = new HttpListenerRequestAdapter(ctx.Request);
ResponseInternal = new HttpListenerResponseAdapter(ctx.Response);
}
示例2: 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;
}
}
}
示例3: TcpHttpContext
public TcpHttpContext(TcpClient client, RavenConfiguration configuration)
{
_client = client;
_configuration = configuration;
_request = new TcpHttpRequest(_client, configuration.Port);
_response = new TcpHttpResponse(_client);
}
示例4: HttpContextAdapter
public HttpContextAdapter(HttpContext context, RavenConfiguration configuration)
{
this.context = context;
this.configuration = configuration;
request = new HttpRequestAdapter(context.Request);
response = new HttpResponseAdapter(context.Response);
}
示例5: CreateDocumentDatabase
private DocumentDatabase CreateDocumentDatabase()
{
var configuration = new RavenConfiguration();
configuration.DataDirectory = Path.Combine(NewDataPath(), "System");
configuration.RunInMemory = configuration.DefaultStorageTypeName == InMemoryRavenConfiguration.VoronTypeName;
return new DocumentDatabase(configuration);
}
示例6: ConfigureServer
protected override void ConfigureServer(RavenConfiguration ravenConfiguration)
{
ravenConfiguration.AnonymousUserAccessMode = AnonymousUserAccessMode.None;
ravenConfiguration.AuthenticationMode = "OAuth";
ravenConfiguration.OAuthTokenCertificate = CertGenerator.GenerateNewCertificate("RavenDB.Test");
ravenConfiguration.Catalog.Catalogs.Add(new TypeCatalog(typeof(FakeAuthenticateClient)));
}
示例7: 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());
}
}
示例8: OnStart
public override bool OnStart()
{
// Set the maximum number of concurrent connections
ServicePointManager.DefaultConnectionLimit = 12;
// For information on handling configuration changes
// see the MSDN topic at http://go.microsoft.com/fwlink/?LinkId=166357.
var drive = MountCloudDrive();
var config = new RavenConfiguration
{
DataDirectory = drive,
AnonymousUserAccessMode = AnonymousUserAccessMode.All,
HttpCompression = true,
DefaultStorageTypeName = "munin",
Port = MyInstanceEndpoint.IPEndpoint.Port,
PluginsDirectory = "plugins"
};
StartRaven(config);
SetupReplication();
RoleEnvironment.Changed += RoleEnvironmentChanged;
RoleEnvironment.StatusCheck += RoleEnvironmentStatusCheck;
return base.OnStart();
}
示例9: EmbeddableDocumentStore
public EmbeddableDocumentStore()
{
Conventions = new DocumentConvention();
Listeners = new DocumentSessionListeners();
Configuration = new RavenConfiguration();
EnlistInDistributedTransactions = true;
}
示例10: CreateRavenDbServer
protected RavenDbServer CreateRavenDbServer(int port,
string dataDirectory = null,
bool runInMemory = true,
string requestedStorage = null,
bool enableAuthentication = false,
string fileSystemName = null,
Action<RavenConfiguration> customConfig = null)
{
NonAdminHttp.EnsureCanListenToWhenInNonAdminContext(port);
var storageType = GetDefaultStorageType(requestedStorage);
var directory = dataDirectory ?? NewDataPath(fileSystemName + "_" + port);
var ravenConfiguration = new RavenConfiguration()
{
Port = port,
DataDirectory = directory,
RunInMemory = storageType.Equals("esent", StringComparison.OrdinalIgnoreCase) == false && runInMemory,
#if DEBUG
RunInUnreliableYetFastModeThatIsNotSuitableForProduction = runInMemory,
#endif
DefaultStorageTypeName = storageType,
AnonymousUserAccessMode = enableAuthentication ? AnonymousUserAccessMode.None : AnonymousUserAccessMode.Admin,
};
ravenConfiguration.Encryption.UseFips = SettingsHelper.UseFipsEncryptionAlgorithms;
ravenConfiguration.FileSystem.MaximumSynchronizationInterval = this.SynchronizationInterval;
ravenConfiguration.FileSystem.DataDirectory = Path.Combine(directory, "FileSystem");
ravenConfiguration.FileSystem.DefaultStorageTypeName = storageType;
if (customConfig != null)
{
customConfig(ravenConfiguration);
}
if (enableAuthentication)
{
Authentication.EnableOnce();
}
var ravenDbServer = new RavenDbServer(ravenConfiguration)
{
UseEmbeddedHttpServer = true
};
ravenDbServer.Initialize();
servers.Add(ravenDbServer);
if (enableAuthentication)
{
EnableAuthentication(ravenDbServer.SystemDatabase);
}
ConfigureServer(ravenDbServer, fileSystemName);
return ravenDbServer;
}
示例11: HttpServer
public HttpServer(RavenConfiguration configuration, DocumentDatabase database)
{
defaultDatabase = database;
defaultConfiguration = configuration;
configuration.Container.SatisfyImportsOnce(this);
foreach (var requestResponder in RequestResponders)
{
requestResponder.Initialize(() => currentDatabase.Value, () => currentConfiguration.Value);
}
}
示例12: HttpServer
public HttpServer(RavenConfiguration configuration, DocumentDatabase database)
{
Configuration = configuration;
configuration.Container.SatisfyImportsOnce(this);
foreach (var requestResponder in RequestResponders)
{
requestResponder.Database = database;
requestResponder.Settings = configuration;
}
}
示例13: TransactionalStorage
public TransactionalStorage(RavenConfiguration configuration, Action onCommit)
{
database = configuration.DataDirectory;
this.configuration = configuration;
this.onCommit = onCommit;
path = database;
if (Path.IsPathRooted(database) == false)
path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, database);
database = Path.Combine(path, "Data");
LimitSystemCache();
Api.JetCreateInstance(out instance, database + Guid.NewGuid());
}
示例14: Init
public static void Init()
{
if (database != null)
return;
lock (locker)
{
if (database != null)
return;
var ravenConfiguration = new RavenConfiguration();
HttpServer.RegisterHttpEndpointTarget();
database = new DocumentDatabase(ravenConfiguration);
database.SpinBackgroundWorkers();
server = new HttpServer(ravenConfiguration, database);
}
}
示例15: CreateRavenDbServer
protected RavenDbServer CreateRavenDbServer(int port,
string dataDirectory = null,
bool runInMemory = true,
string requestedStorage = null,
bool enableAuthentication = false,
string fileSystemName = null)
{
var storageType = GetDefaultStorageType(requestedStorage);
var directory = dataDirectory ?? NewDataPath(fileSystemName + "_" + port);
var ravenConfiguration = new RavenConfiguration()
{
Port = port,
DataDirectory = directory,
FileSystemDataDirectory = Path.Combine(directory, "FileSystem"),
RunInMemory = storageType.Equals("esent", StringComparison.OrdinalIgnoreCase) == false && runInMemory,
#if DEBUG
RunInUnreliableYetFastModeThatIsNotSuitableForProduction = runInMemory,
#endif
DefaultStorageTypeName = storageType,
AnonymousUserAccessMode = enableAuthentication ? AnonymousUserAccessMode.None : AnonymousUserAccessMode.Admin,
};
if (enableAuthentication)
{
Authentication.EnableOnce();
}
var ravenDbServer = new RavenDbServer(ravenConfiguration)
{
UseEmbeddedHttpServer = true
};
ravenDbServer.Initialize();
servers.Add(ravenDbServer);
if (enableAuthentication)
{
EnableAuthentication(ravenDbServer.SystemDatabase);
}
ConfigureServer(ravenDbServer, fileSystemName);
return ravenDbServer;
}