Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
CollectionInformation.cs
1using System.Collections.Generic;
3
5{
9 [TypeName(TypeNameSerialization.FullName)]
11 {
16 : this(string.Empty, string.Empty, false, new PropertyDefinition[0])
17 {
18 }
19
29 {
30 this.IndexCollectionName = IndexCollectionName;
31 this.CollectionName = CollectionName;
32 this.IndexForFullTextSearch = IndexForFullTextSearch;
33 this.Properties = Properties;
34 }
35
39 public string IndexCollectionName { get; set; }
40
44 public string CollectionName { get; set; }
45
49 public bool IndexForFullTextSearch { get; set; }
50
54 public PropertyDefinition[] Properties { get; set; }
55
59 public PropertyType[] PropertyTypes { get; set; }
60
68 {
69 Dictionary<string, PropertyDefinition> ByName = new Dictionary<string, PropertyDefinition>();
70 bool New = false;
71
72 foreach (PropertyDefinition Property in this.Properties)
73 ByName[Property.Definition] = Property;
74
75 foreach (PropertyDefinition Property in Properties)
76 {
77 if (!ByName.ContainsKey(Property.Definition))
78 {
79 ByName[Property.Definition] = Property;
80 New = true;
81 }
82 }
83
84 if (!New)
85 return false;
86
87 int c = ByName.Count;
88 PropertyDefinition[] Definitions = new PropertyDefinition[c];
89
90 ByName.Values.CopyTo(Definitions, 0);
91
92 this.Properties = Definitions;
93 this.IndexForFullTextSearch = true;
94
95 return true;
96 }
97
105 {
106 Dictionary<string, PropertyDefinition> ByName = new Dictionary<string, PropertyDefinition>();
107 bool Removed = false;
108
109 foreach (PropertyDefinition Property in this.Properties)
110 ByName[Property.Definition] = Property;
111
112 foreach (PropertyDefinition Property in Properties)
113 {
114 if (ByName.Remove(Property.Definition))
115 Removed = true;
116 }
117
118 if (!Removed)
119 return false;
120
121 int c = ByName.Count;
122 PropertyDefinition[] Definitions = new PropertyDefinition[c];
123
124 ByName.Values.CopyTo(Definitions, 0);
125
126 this.Properties = Definitions;
127 this.IndexForFullTextSearch = c > 0;
128
129 return true;
130 }
131 }
132}
Contains information about a collection, in relation to full-text-search.
bool IndexForFullTextSearch
If collection should be indexed.
bool AddIndexableProperties(params PropertyDefinition[] Properties)
Adds properties for full-text-search indexation.
PropertyDefinition[] Properties
Properties to index
CollectionInformation(string IndexCollectionName, string CollectionName, bool IndexForFullTextSearch, params PropertyDefinition[] Properties)
Contains information about a collection, in relation to full-text-search.
bool RemoveIndexableProperties(params PropertyDefinition[] Properties)
Removes properties from full-text-search indexation.
PropertyType[] PropertyTypes
Types of indexed properties.
CollectionInformation()
Contains information about a collection, in relation to full-text-search.
TypeNameSerialization
How the type name should be serialized.
PropertyType
Type of indexed property.