/
IndexingDirective.cs
52 lines (47 loc) · 1.8 KB
/
IndexingDirective.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------
namespace Microsoft.Azure.Cosmos
{
using System;
/// <summary>
/// Specifies whether or not the resource in the Azure Cosmos DB database is to be indexed.
/// </summary>
public enum IndexingDirective
{
/// <summary>
/// Use any pre-defined/pre-configured defaults.
/// </summary>
Default,
/// <summary>
/// Index the resource.
/// </summary>
Include,
/// <summary>
/// Do not index the resource.
/// </summary>
Exclude
}
#pragma warning disable SA1649 // File name should match first type name
internal static class IndexingDirectiveStrings
#pragma warning restore SA1649 // File name should match first type name
{
public static readonly string Default = IndexingDirective.Default.ToString();
public static readonly string Include = IndexingDirective.Include.ToString();
public static readonly string Exclude = IndexingDirective.Exclude.ToString();
public static string FromIndexingDirective(IndexingDirective directive)
{
switch (directive)
{
case IndexingDirective.Default:
return IndexingDirectiveStrings.Default;
case IndexingDirective.Exclude:
return IndexingDirectiveStrings.Exclude;
case IndexingDirective.Include:
return IndexingDirectiveStrings.Include;
default:
throw new ArgumentException(string.Format("Missing indexing directive string for {0}", directive));
}
}
}
}