Ejemplo n.º 1
0
 ///<summary>
 /// Create a new instance
 ///</summary>
 public EmbeddedDatabaseCommands(DocumentDatabase database, DocumentConvention convention, Guid?sessionId)
 {
     profilingInformation = ProfilingInformation.CreateProfilingInformation(sessionId);
     this.database        = database;
     this.convention      = convention;
     OperationsHeaders    = new NameValueCollection();
 }
        public override void GetData(object target, System.IO.Stream outgoingData)
        {
            var session = (DocumentSession)target;
            var profilingInformation = ((DocumentStore)session.DocumentStore).GetProfilingInformationFor(session.Id) ??
                                       ProfilingInformation.CreateProfilingInformation(session.Id);

            new BinaryFormatter().Serialize(outgoingData, profilingInformation);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AsyncServerClient"/> class.
 /// </summary>
 public AsyncServerClient(string url, DocumentConvention convention, ICredentials credentials, HttpJsonRequestFactory jsonRequestFactory, Guid?sessionId)
 {
     profilingInformation    = ProfilingInformation.CreateProfilingInformation(sessionId);
     this.url                = url.EndsWith("/") ? url.Substring(0, url.Length - 1) : url;
     this.convention         = convention;
     this.credentials        = credentials;
     this.jsonRequestFactory = jsonRequestFactory;
     this.sessionId          = sessionId;
 }
Ejemplo n.º 4
0
        public ProfilingInformation Filter(ProfilingInformation information)
        {
            var profilingInformation = ProfilingInformation.CreateProfilingInformation(information.Id);

            profilingInformation.At      = information.At;
            profilingInformation.Context = information.Context;
            profilingInformation.DurationMilliseconds = information.DurationMilliseconds;
            profilingInformation.Requests             = information.Requests.Select(FilterRequest).ToList();
            return(profilingInformation);
        }
Ejemplo n.º 5
0
 ///<summary>
 /// Create a new instance
 ///</summary>
 public EmbeddedDatabaseCommands(DocumentDatabase database, DocumentConvention convention, Guid?sessionId)
 {
     profilingInformation = ProfilingInformation.CreateProfilingInformation(sessionId);
     this.database        = database;
     this.convention      = convention;
     OperationsHeaders    = new NameValueCollection();
     if (database.Configuration.IsSystemDatabase() == false)
     {
         throw new InvalidOperationException("Database must be a system database");
     }
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AsyncServerClient"/> class.
        /// </summary>
        public AsyncServerClient(string url, DocumentConvention convention, ICredentials credentials, HttpJsonRequestFactory jsonRequestFactory, Guid?sessionId, Task veryFirstRequest)
        {
            profilingInformation    = ProfilingInformation.CreateProfilingInformation(sessionId);
            this.url                = url.EndsWith("/") ? url.Substring(0, url.Length - 1) : url;
            this.convention         = convention;
            this.credentials        = credentials;
            this.jsonRequestFactory = jsonRequestFactory;
            this.sessionId          = sessionId;
            this.veryFirstRequest   = veryFirstRequest;

            jsonRequestFactory.ConfigureRequest += (sender, args) =>
            {
                args.JsonRequest.WaitForTask = veryFirstRequest;
            };
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AsyncServerClient"/> class.
        /// </summary>
        public AsyncServerClient(string url, DocumentConvention convention, ICredentials credentials, HttpJsonRequestFactory jsonRequestFactory, Guid?sessionId)
        {
            profilingInformation    = ProfilingInformation.CreateProfilingInformation(sessionId);
            this.url                = url.EndsWith("/") ? url.Substring(0, url.Length - 1) : url;
            this.convention         = convention;
            this.credentials        = credentials;
            this.jsonRequestFactory = jsonRequestFactory;
            this.sessionId          = sessionId;

            // required to ensure just a single auth dialog
            Task task = jsonRequestFactory.CreateHttpJsonRequest(this, (url + "/docs?pageSize=0").NoCache(), "GET", credentials, convention)
                        .ReadResponseStringAsync();

            jsonRequestFactory.ConfigureRequest += (sender, args) =>
            {
                args.JsonRequest.WaitForTask = task;
            };
        }