public AutoMapIndexDefinition(string collection, AutoIndexField[] fields) : base(AutoIndexNameFinder.FindMapIndexName(collection, fields), collection, fields) { if (fields.Length == 0) { throw new ArgumentException("You must specify at least one field.", nameof(fields)); } }
public void IndexNameFinderShouldPreservePascalCaseFieldNames() { var name = AutoIndexNameFinder.FindMapIndexName("Users", new[] { new AutoIndexField() { Name = "LastName", Indexing = AutoFieldIndexing.Default | AutoFieldIndexing.Search } }); Assert.Equal("Auto/Users/BySearch(LastName)", name); }
public AutoMapReduceIndexDefinition(string collection, AutoIndexField[] mapFields, AutoIndexField[] groupByFields) : base(AutoIndexNameFinder.FindMapReduceIndexName(collection, mapFields, groupByFields), collection, mapFields) { GroupByFields = groupByFields.ToDictionary(x => x.Name, x => x, StringComparer.Ordinal); MapAndGroupByFields = new Dictionary <string, AutoIndexField>(MapFields.Count + GroupByFields.Count); foreach (var field in MapFields) { MapAndGroupByFields[field.Key] = field.Value.As <AutoIndexField>(); } foreach (var field in GroupByFields) { MapAndGroupByFields[field.Key] = field.Value; foreach (var indexField in field.Value.ToIndexFields()) { IndexFields.Add(indexField.Name, indexField); } } }
public AutoMapReduceIndexDefinition(string collection, AutoIndexField[] mapFields, AutoIndexField[] groupByFields, IndexDeploymentMode?deploymentMode, long?indexVersion = null) : base(AutoIndexNameFinder.FindMapReduceIndexName(collection, mapFields, groupByFields), collection, mapFields, deploymentMode, indexVersion) { OrderedGroupByFields = groupByFields.OrderBy(x => x.Name, StringComparer.Ordinal).ToArray(); GroupByFields = groupByFields.ToDictionary(x => x.Name, x => x, StringComparer.Ordinal); MapAndGroupByFields = new Dictionary <string, AutoIndexField>(MapFields.Count + GroupByFields.Count); foreach (var field in MapFields) { MapAndGroupByFields[field.Key] = field.Value.As <AutoIndexField>(); } foreach (var field in GroupByFields) { MapAndGroupByFields[field.Key] = field.Value; foreach (var indexField in field.Value.ToIndexFields()) { IndexFields.Add(indexField.Name, indexField); } } }
public AutoMapIndexDefinition(string collection, AutoIndexField[] fields) : base(AutoIndexNameFinder.FindMapIndexName(collection, fields), collection, fields) { }
public AutoMapIndexDefinition(string collection, AutoIndexField[] fields, IndexDeploymentMode?deploymentMode, long?indexVersion = null) : base(AutoIndexNameFinder.FindMapIndexName(collection, fields), collection, fields, deploymentMode, indexVersion) { }