コード例 #1
0
        /// <summary>
        /// Initialize the document store access method to RavenDB
        /// </summary>
        protected virtual void InitializeInternal()
        {
#if !SILVERLIGHT
            var replicationInformer = new ReplicationInformer(Conventions);
            databaseCommandsGenerator = () =>
            {
                var serverClient = new ServerClient(Url, Conventions, credentials, replicationInformer, jsonRequestFactory, currentSessionId);
                if (string.IsNullOrEmpty(DefaultDatabase))
                {
                    return(serverClient);
                }
                return(serverClient.ForDatabase(DefaultDatabase));
            };
#endif
#if !NET_3_5
            asyncDatabaseCommandsGenerator = () =>
            {
                var asyncServerClient = new AsyncServerClient(Url, Conventions, credentials, jsonRequestFactory, currentSessionId);
                if (string.IsNullOrEmpty(DefaultDatabase))
                {
                    return(asyncServerClient);
                }
                return(asyncServerClient.ForDatabase(DefaultDatabase));
            };
#endif
        }
コード例 #2
0
ファイル: DocumentStore.cs プロジェクト: ninjaferret/Paramore
        protected virtual void InitializeInternal()
        {
            ReplicationInformer replicationInformer = new ReplicationInformer(this.Conventions);

            this.databaseCommandsGenerator = (Func <IDatabaseCommands>)(() =>
            {
                ServerClient local_0 = new ServerClient(this.Url, this.Conventions, this.credentials, replicationInformer, this.jsonRequestFactory, DocumentStore.currentSessionId);
                if (string.IsNullOrEmpty(this.DefaultDatabase))
                {
                    return((IDatabaseCommands)local_0);
                }
                else
                {
                    return(local_0.ForDatabase(this.DefaultDatabase));
                }
            });
            this.asyncDatabaseCommandsGenerator = (Func <IAsyncDatabaseCommands>)(() =>
            {
                AsyncServerClient local_0 = new AsyncServerClient(this.Url, this.Conventions, this.credentials, this.jsonRequestFactory, DocumentStore.currentSessionId);
                if (string.IsNullOrEmpty(this.DefaultDatabase))
                {
                    return((IAsyncDatabaseCommands)local_0);
                }
                else
                {
                    return(local_0.ForDatabase(this.DefaultDatabase));
                }
            });
        }
コード例 #3
0
        /// <summary>
        /// Initialize the document store access method to RavenDB
        /// </summary>
        protected virtual void InitializeInternal()
        {
            var rootDatabaseUrl = MultiDatabase.GetRootDatabaseUrl(Url);

#if !DNXCORE50
            // TODO [ppekrol] how to set this?
            rootServicePoint = ServicePointManager.FindServicePoint(new Uri(rootDatabaseUrl));
            rootServicePoint.UseNagleAlgorithm = false;
            rootServicePoint.Expect100Continue = false;
            rootServicePoint.ConnectionLimit   = 256;
            rootServicePoint.MaxIdleTime       = Timeout.Infinite;
#endif

            databaseCommandsGenerator = () =>
            {
                var asyncServerClient = new AsyncServerClient(Url, Conventions, new OperationCredentials(ApiKey, Credentials), jsonRequestFactory,
                                                              currentSessionId, GetRequestExecuterForDatabase, GetRequestTimeMetricForUrl, null,
                                                              Listeners.ConflictListeners, true);

                var serverClient = new ServerClient(asyncServerClient);

                if (string.IsNullOrEmpty(DefaultDatabase))
                {
                    return(serverClient);
                }
                return(serverClient.ForDatabase(DefaultDatabase));
            };

            asyncDatabaseCommandsGenerator = () =>
            {
                var asyncServerClient = new AsyncServerClient(Url, Conventions, new OperationCredentials(ApiKey, Credentials),
                                                              jsonRequestFactory, currentSessionId,
                                                              GetRequestExecuterForDatabase, GetRequestTimeMetricForUrl, null,
                                                              Listeners.ConflictListeners, true);

                if (string.IsNullOrEmpty(DefaultDatabase))
                {
                    return(asyncServerClient);
                }
                return(asyncServerClient.ForDatabase(DefaultDatabase));
            };
        }
コード例 #4
0
ファイル: DocumentStore.cs プロジェクト: SteveDunn/Paramore
 protected virtual void InitializeInternal()
 {
     ReplicationInformer replicationInformer = new ReplicationInformer(this.Conventions);
       this.databaseCommandsGenerator = (Func<IDatabaseCommands>) (() =>
       {
     ServerClient local_0 = new ServerClient(this.Url, this.Conventions, this.credentials, replicationInformer, this.jsonRequestFactory, DocumentStore.currentSessionId);
     if (string.IsNullOrEmpty(this.DefaultDatabase))
       return (IDatabaseCommands) local_0;
     else
       return local_0.ForDatabase(this.DefaultDatabase);
       });
       this.asyncDatabaseCommandsGenerator = (Func<IAsyncDatabaseCommands>) (() =>
       {
     AsyncServerClient local_0 = new AsyncServerClient(this.Url, this.Conventions, this.credentials, this.jsonRequestFactory, DocumentStore.currentSessionId);
     if (string.IsNullOrEmpty(this.DefaultDatabase))
       return (IAsyncDatabaseCommands) local_0;
     else
       return local_0.ForDatabase(this.DefaultDatabase);
       });
 }