/// <summary> /// Initializes a new instance of the <see cref="AsyncServerClient"/> class. /// </summary> /// <param name="url">The URL.</param> /// <param name="convention">The convention.</param> /// <param name="credentials">The credentials.</param> public AsyncServerClient(string url, DocumentConvention convention, ICredentials credentials) { Guard.Assert(() => !string.IsNullOrEmpty(url)); Guard.Assert(() => convention != null); WebRequest.RegisterPrefix("http://", WebRequestCreator.ClientHttp); DatabaseAddress = new Uri(url); Convention = convention; Credentials = credentials; ContextStorage = new Dictionary<HttpJsonRequest, SynchronizationContext>(); DocumentMapper = new DocumentMapper(); IndexMapper = new IndexMapper(Convention); AttachmentMapper = new AttachmentMapper(); StatisticsMapper = new StatisticsMapper(); QueryResultMapper = new QueryResultMapper(); }
/// <summary> /// Generates the document key using identity. /// </summary> /// <param name="conventions">The conventions.</param> /// <param name="entity">The entity.</param> /// <returns></returns> public static string GenerateDocumentKeyUsingIdentity(DocumentConvention conventions, object entity) { return conventions.FindTypeTagName(entity.GetType()).ToLowerInvariant() + "/"; }
public AsyncStatisticsSession(string databaseUrl) { Convention = new DocumentConvention(); Client = new AsyncServerClient(databaseUrl, Convention, Credentials); }