Line data Source code
1 : #region Copyright
2 : // // -----------------------------------------------------------------------
3 : // // <copyright company="Chinchilla Software Limited">
4 : // // Copyright Chinchilla Software Limited. All rights reserved.
5 : // // </copyright>
6 : // // -----------------------------------------------------------------------
7 : #endregion
8 :
9 : using Microsoft.Azure.Documents;
10 : using Microsoft.Azure.Documents.Client;
11 :
12 : namespace Cqrs.Azure.DocumentDb
13 : {
14 : /// <summary>
15 : /// A cache manager for DocumentDB clients, databases and collections.
16 : /// </summary>
17 : public interface IAzureDocumentDbConnectionCache
18 : {
19 : /// <summary>
20 : /// Gets the <see cref="DocumentClient"/>.
21 : /// </summary>
22 : /// <param name="key">The name of the <see cref="DocumentClient"/> to get.</param>
23 : /// <param name="client">If the <see cref="DocumentClient"/> is found, it is returned here; otherwise null is returned. This parameter is passed uninitialized.</param>
24 : /// <returns>true if the <see cref="DocumentClient"/> is found; otherwise, false.</returns>
25 1 : bool TryGetClient(string key, out DocumentClient client);
26 :
27 : /// <summary>
28 : /// Sets the provided <paramref name="client"/>.
29 : /// </summary>
30 : /// <param name="key">The name of the <see cref="DocumentClient"/> to get.</param>
31 : /// <param name="client">The <see cref="DocumentClient"/> to set.</param>
32 1 : void SetClient(string key, DocumentClient client);
33 :
34 : /// <summary>
35 : /// Gets the <see cref="Database"/>.
36 : /// </summary>
37 : /// <param name="key">The name of the <see cref="Database"/> to get.</param>
38 : /// <param name="database">If the <see cref="Database"/> is found, it is returned here; otherwise null is returned. This parameter is passed uninitialized.</param>
39 : /// <returns>true if the <see cref="Database"/> is found; otherwise, false.</returns>
40 1 : bool TryGetDatabase(string key, out Database database);
41 :
42 : /// <summary>
43 : /// Sets the provided <paramref name="database"/>.
44 : /// </summary>
45 : /// <param name="key">The name of the <see cref="Database"/> to get.</param>
46 : /// <param name="database">The <see cref="Database"/> to set.</param>
47 1 : void SetDatabase(string key, Database database);
48 :
49 : /// <summary>
50 : /// Gets the <see cref="DocumentCollection"/>.
51 : /// </summary>
52 : /// <param name="key">The name of the <see cref="DocumentCollection"/> to get.</param>
53 : /// <param name="documentCollection">If the <see cref="DocumentCollection"/> is found, it is returned here; otherwise null is returned. This parameter is passed uninitialized.</param>
54 : /// <returns>true if the <see cref="DocumentCollection"/> is found; otherwise, false.</returns>
55 1 : bool TryGetDocumentCollection(string key, out DocumentCollection documentCollection);
56 :
57 : /// <summary>
58 : /// Sets the provided <paramref name="documentCollection"/>.
59 : /// </summary>
60 : /// <param name="key">The name of the <see cref="DocumentCollection"/> to get.</param>
61 : /// <param name="documentCollection">The <see cref="DocumentCollection"/> to set.</param>
62 1 : void SetDocumentCollection(string key, DocumentCollection documentCollection);
63 : }
64 : }
|