本文整理汇总了C#中RavenConnectionStringOptions类的典型用法代码示例。如果您正苦于以下问题:C# RavenConnectionStringOptions类的具体用法?C# RavenConnectionStringOptions怎么用?C# RavenConnectionStringOptions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RavenConnectionStringOptions类属于命名空间,在下文中一共展示了RavenConnectionStringOptions类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ExportAttachments
protected override Task<Etag> ExportAttachments(RavenConnectionStringOptions src, JsonTextWriter jsonWriter, Etag lastEtag, Etag maxEtag)
{
if (maxEtag != null)
throw new ArgumentException("We don't support maxEtag in SmugglerDatabaseApi", maxEtag);
return base.ExportAttachments(src, jsonWriter, lastEtag, null);
}
开发者ID:CosminLazar,项目名称:ravendb,代码行数:7,代码来源:SmugglerDatabaseApi.cs
示例2: GetIndexes
protected async override Task<RavenJArray> GetIndexes(RavenConnectionStringOptions src, int totalCount)
{
RavenJArray indexes = null;
var request = CreateRequest(src, "/indexes?pageSize=" + SmugglerOptions.BatchSize + "&start=" + totalCount);
request.ExecuteRequest(reader => indexes = RavenJArray.Load(new JsonTextReader(reader)));
return indexes;
}
开发者ID:paulcbetts,项目名称:ravendb,代码行数:7,代码来源:SmugglerApi.cs
示例3: CopyAttachmentsToFileSystem
public CopyAttachmentsToFileSystem(RavenConnectionStringOptions databaseConnectionOptions, RavenConnectionStringOptions fileSystemConnectionOptions, string fileSystemName, bool deleteCopiedAttachments)
{
this.databaseConnectionOptions = databaseConnectionOptions;
this.fileSystemConnectionOptions = fileSystemConnectionOptions;
this.fileSystemName = fileSystemName;
this.deleteCopiedAttachments = deleteCopiedAttachments;
}
开发者ID:ReginaBricker,项目名称:ravendb,代码行数:7,代码来源:CopyAttachmentsToFileSystem.cs
示例4: ConfigureRequest
public void ConfigureRequest(RavenConnectionStringOptions options, HttpWebRequest request)
{
if (RequestTimeoutInMs.HasValue)
request.Timeout = RequestTimeoutInMs.Value;
if (AllowWriteStreamBuffering.HasValue)
{
request.AllowWriteStreamBuffering = AllowWriteStreamBuffering.Value;
if(AllowWriteStreamBuffering.Value == false)
request.SendChunked = true;
}
if (options.ApiKey == null)
{
request.Credentials = options.Credentials ?? CredentialCache.DefaultNetworkCredentials;
return;
}
var webRequestEventArgs = new WebRequestEventArgs { Request = request, Credentials = new OperationCredentials(options.ApiKey, options.Credentials)};
AbstractAuthenticator existingAuthenticator;
if (authenticators.TryGetValue(GetCacheKey(options), out existingAuthenticator))
{
existingAuthenticator.ConfigureRequest(this, webRequestEventArgs);
}
else
{
var basicAuthenticator = new BasicAuthenticator(enableBasicAuthenticationOverUnsecuredHttp: false);
var securedAuthenticator = new SecuredAuthenticator();
basicAuthenticator.ConfigureRequest(this, webRequestEventArgs);
securedAuthenticator.ConfigureRequest(this, webRequestEventArgs);
}
}
开发者ID:cocytus,项目名称:ravendb,代码行数:34,代码来源:HttpRavenRequestFactory.cs
示例5: SmugglerShouldThrowIfDatabaseDoesNotExist
public async Task SmugglerShouldThrowIfDatabaseDoesNotExist()
{
var path = Path.GetTempFileName();
try
{
using (var store = NewRemoteDocumentStore())
{
var connectionStringOptions =
new RavenConnectionStringOptions
{
Url = store.Url,
DefaultDatabase = "DoesNotExist"
};
var smuggler = new SmugglerDatabaseApi();
var e = await AssertAsync.Throws<SmugglerException>(() => smuggler.ImportData(
new SmugglerImportOptions<RavenConnectionStringOptions> { FromFile = path, To = connectionStringOptions }));
Assert.Equal(string.Format("Smuggler does not support database creation (database 'DoesNotExist' on server '{0}' must exist before running Smuggler).", store.Url), e.Message);
e = await AssertAsync.Throws<SmugglerException>(() => smuggler.ExportData(
new SmugglerExportOptions<RavenConnectionStringOptions> { ToFile = path, From = connectionStringOptions }));
Assert.Equal(string.Format("Smuggler does not support database creation (database 'DoesNotExist' on server '{0}' must exist before running Smuggler).", store.Url), e.Message);
}
}
finally
{
IOExtensions.DeleteFile(path);
}
}
开发者ID:JackWangCUMT,项目名称:ravendb,代码行数:32,代码来源:SmugglerExecutionTests.cs
示例6: should_respect_defaultdb_properly
public void should_respect_defaultdb_properly()
{
var connectionStringOptions = new RavenConnectionStringOptions {Url = "http://localhost:8080", DefaultDatabase = "test"};
var rootDatabaseUrl = GetRootDatabaseUrl(connectionStringOptions.Url);
var docUrl = rootDatabaseUrl + "/docs/Raven/Databases/" + connectionStringOptions.DefaultDatabase;
Console.WriteLine(docUrl);
}
开发者ID:WimVergouwe,项目名称:ravendb,代码行数:7,代码来源:Smuggler.cs
示例7: TrafficToolConfiguration
public TrafficToolConfiguration()
{
ConnectionString = new RavenConnectionStringOptions();
IsCompressed = false;
Timeout = TimeSpan.MinValue;
PrintOutput = true;
}
开发者ID:j2jensen,项目名称:ravendb,代码行数:7,代码来源:TrafficRecorderConfiguration.cs
示例8: ConfigureRequest
public void ConfigureRequest(RavenConnectionStringOptions options, WebRequest request)
{
if (RequestTimeoutInMs.HasValue)
request.Timeout = RequestTimeoutInMs.Value;
if (options.ApiKey == null)
{
request.Credentials = options.Credentials ?? CredentialCache.DefaultNetworkCredentials;
return;
}
var webRequestEventArgs = new WebRequestEventArgs { Request = request };
AbstractAuthenticator existingAuthenticator;
if (authenticators.TryGetValue(GetCacheKey(options), out existingAuthenticator))
{
existingAuthenticator.ConfigureRequest(this, webRequestEventArgs);
}
else
{
var basicAuthenticator = new BasicAuthenticator(options.ApiKey, enableBasicAuthenticationOverUnsecuredHttp: false);
var securedAuthenticator = new SecuredAuthenticator(options.ApiKey);
basicAuthenticator.ConfigureRequest(this, webRequestEventArgs);
securedAuthenticator.ConfigureRequest(this, webRequestEventArgs);
}
}
开发者ID:nzaugg,项目名称:ravendb,代码行数:27,代码来源:HttpRavenRequestFactory.cs
示例9: HandleUnauthorizedResponse
private Action<HttpWebRequest> HandleUnauthorizedResponse(RavenConnectionStringOptions options, WebResponse webResponse)
{
if (options.ApiKey == null)
return null;
var oauthSource = webResponse.Headers["OAuth-Source"];
var useBasicAuthenticator =
string.IsNullOrEmpty(oauthSource) == false &&
oauthSource.EndsWith("/OAuth/API-Key", StringComparison.CurrentCultureIgnoreCase) == false;
if (string.IsNullOrEmpty(oauthSource))
oauthSource = options.Url + "/OAuth/API-Key";
var authenticator = authenticators.GetOrAdd(
GetCacheKey(options),
_ =>
{
if (useBasicAuthenticator)
{
return new BasicAuthenticator(enableBasicAuthenticationOverUnsecuredHttp: false);
}
return new SecuredAuthenticator();
});
return authenticator.DoOAuthRequest(oauthSource, options.ApiKey);
}
开发者ID:cocytus,项目名称:ravendb,代码行数:28,代码来源:HttpRavenRequestFactory.cs
示例10: CreateFileSystemClient
protected AsyncFilesServerClient CreateFileSystemClient(RavenConnectionStringOptions options, string fileSystemName)
{
var fsClient = new AsyncFilesServerClient(options.Url, fileSystemName, apiKey: options.ApiKey, credentials: options.Credentials);
ValidateThatServerIsUpAndFileSystemExists(fsClient);
return fsClient;
}
开发者ID:j2jensen,项目名称:ravendb,代码行数:8,代码来源:MigrationTask.cs
示例11: GetCredentials
private static NetworkCredential GetCredentials(RavenConnectionStringOptions connectionStringOptions)
{
var cred = connectionStringOptions.Credentials as NetworkCredential;
if (cred != null)
return cred;
cred = new NetworkCredential();
connectionStringOptions.Credentials = cred;
return cred;
}
开发者ID:VPashkov,项目名称:ravendb,代码行数:9,代码来源:TrafficRecorderConfiguration.cs
示例12: GetDocuments
public Task<IAsyncEnumerator<RavenJObject>> GetDocuments(RavenConnectionStringOptions src, Etag lastEtag, int take)
{
const int dummy = 0;
var enumerator = database.Documents.GetDocumentsAsJson(dummy, Math.Min(Options.BatchSize, take), lastEtag, CancellationToken.None)
.ToList()
.Cast<RavenJObject>()
.GetEnumerator();
return new CompletedTask<IAsyncEnumerator<RavenJObject>>(new AsyncEnumeratorBridge<RavenJObject>(enumerator));
}
开发者ID:ricardobrandao,项目名称:ravendb,代码行数:10,代码来源:SmugglerEmbeddedDatabaseOperations.cs
示例13: ConfigureRequest
public void ConfigureRequest(RavenConnectionStringOptions options, WebRequest request)
{
request.Credentials = options.Credentials ?? CredentialCache.DefaultNetworkCredentials;
if (RequestTimeoutInMs.HasValue)
request.Timeout = RequestTimeoutInMs.Value;
if (string.IsNullOrEmpty(options.CurrentOAuthToken) == false)
request.Headers["Authorization"] = options.CurrentOAuthToken;
}
开发者ID:neiz,项目名称:ravendb,代码行数:10,代码来源:HttpRavenRequestFactory.cs
示例14: should_respect_defaultdb_properly
public void should_respect_defaultdb_properly()
{
var connectionStringOptions = new RavenConnectionStringOptions();
//SmugglerAction action = SmugglerAction.Import;
connectionStringOptions.Url = "http://localhost:8080";
connectionStringOptions.DefaultDatabase = "test";
var api = new SmugglerTester(connectionStringOptions);
var rootDatabaseUrl = GetRootDatabaseUrl(connectionStringOptions.Url);
var docUrl = rootDatabaseUrl + "/docs/Raven/Databases/" + connectionStringOptions.DefaultDatabase;
Console.WriteLine(docUrl);
}
开发者ID:925coder,项目名称:ravendb,代码行数:12,代码来源:Smuggler.cs
示例15: HandleUnauthorizedResponse
private bool HandleUnauthorizedResponse(RavenConnectionStringOptions options, WebResponse webResponse)
{
if (options.ApiKey == null)
return false;
var value = authenticators.GetOrAdd(options.ApiKey, s => new SecuredAuthenticator(s));
var oauthSource = options.Url + "/OAuth/API-Key";
var result = value.DoOAuthRequest(oauthSource);
return result != null;
}
开发者ID:Nordis,项目名称:ravendb,代码行数:12,代码来源:HttpRavenRequestFactory.cs
示例16: PrepareOAuthRequest
private HttpWebRequest PrepareOAuthRequest(RavenConnectionStringOptions options, string oauthSource)
{
var authRequest = (HttpWebRequest) WebRequest.Create(oauthSource);
authRequest.Credentials = options.Credentials;
authRequest.Headers["Accept-Encoding"] = "deflate,gzip";
authRequest.Accept = "application/json;charset=UTF-8";
authRequest.Headers["grant_type"] = "client_credentials";
if (string.IsNullOrEmpty(options.ApiKey) == false)
authRequest.Headers["Api-Key"] = options.ApiKey;
return authRequest;
}
开发者ID:neiz,项目名称:ravendb,代码行数:14,代码来源:HttpRavenRequestFactory.cs
示例17: RefreshOauthToken
private bool RefreshOauthToken(RavenConnectionStringOptions options, WebResponse response)
{
var oauthSource = response.Headers["OAuth-Source"];
if (string.IsNullOrEmpty(oauthSource))
return false;
var authRequest = PrepareOAuthRequest(options, oauthSource);
using (var authResponse = authRequest.GetResponse())
using (var stream = authResponse.GetResponseStreamWithHttpDecompression())
using (var reader = new StreamReader(stream))
{
options.CurrentOAuthToken = "Bearer " + reader.ReadToEnd();
}
return true;
}
开发者ID:neiz,项目名称:ravendb,代码行数:15,代码来源:HttpRavenRequestFactory.cs
示例18: Smuggler
public Smuggler()
{
#region smuggler-api
var connectionStringOptions = new RavenConnectionStringOptions
{
ApiKey = "ApiKey",
Credentials = new NetworkCredential("username", "password", "domain"),
DefaultDatabase = "database",
Url = "http://localhost:8080",
};
var smugglerApi = new SmugglerApi(connectionStringOptions);
smugglerApi.ExportData(new SmugglerOptions { File = "dump.raven", OperateOnTypes = ItemType.Documents | ItemType.Indexes | ItemType.Attachments });
smugglerApi.ImportData(new SmugglerOptions { File = "dump.raven", OperateOnTypes = ItemType.Documents | ItemType.Indexes });
#endregion
}
开发者ID:jamesfarrer,项目名称:docs,代码行数:15,代码来源:Smuggler.cs
示例19: CreateStore
protected DocumentStore CreateStore(RavenConnectionStringOptions options)
{
var s = new DocumentStore
{
Url = options.Url,
ApiKey = options.ApiKey,
Credentials = options.Credentials
};
s.Initialize();
ValidateThatServerIsUpAndDatabaseExists(options, s);
s.DefaultDatabase = options.DefaultDatabase;
return s;
}
开发者ID:j2jensen,项目名称:ravendb,代码行数:17,代码来源:MigrationTask.cs
示例20: CheckDestinations
private ReplicationInfoStatus[] CheckDestinations(ReplicationDocument replicationDocument)
{
var results = new ReplicationInfoStatus[replicationDocument.Destinations.Count];
Parallel.ForEach(replicationDocument.Destinations, (replicationDestination,state,i) =>
{
var url = replicationDestination.Url;
if (!url.ToLower().Contains("/databases/"))
{
url += "/databases/" + replicationDestination.Database;
}
var result = new ReplicationInfoStatus
{
Url = url,
Status = "Valid",
Code = (int)HttpStatusCode.OK
};
results[i] = result;
var ravenConnectionStringOptions = new RavenConnectionStringOptions
{
ApiKey = replicationDestination.ApiKey,
DefaultDatabase = replicationDestination.Database,
};
if (string.IsNullOrEmpty(replicationDestination.Username) == false)
{
ravenConnectionStringOptions.Credentials = new NetworkCredential(replicationDestination.Username,
replicationDestination.Password,
replicationDestination.Domain ?? string.Empty);
}
var request = requestFactory.Create(url + "/replication/info", "POST", ravenConnectionStringOptions);
try
{
request.ExecuteRequest();
}
catch (WebException e)
{
FillStatus(result, e);
}
});
return results;
}
开发者ID:925coder,项目名称:ravendb,代码行数:46,代码来源:AdminReplicationInfo.cs
注:本文中的RavenConnectionStringOptions类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论