当前位置: 首页>>代码示例>>C#>>正文


C# RavenConnectionStringOptions类代码示例

本文整理汇总了C#中RavenConnectionStringOptions的典型用法代码示例。如果您正苦于以下问题:C# RavenConnectionStringOptions类的具体用法?C# RavenConnectionStringOptions怎么用?C# RavenConnectionStringOptions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


RavenConnectionStringOptions类属于命名空间,在下文中一共展示了RavenConnectionStringOptions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的RavenConnectionStringOptions类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。