/// <summary> /// Initializes a new instance of the Index class. /// </summary> public Index(string name, IList <Field> fields, IList <ScoringProfile> scoringProfiles = default(IList <ScoringProfile>), string defaultScoringProfile = default(string), CorsOptions corsOptions = default(CorsOptions), IList <Suggester> suggesters = default(IList <Suggester>), IList <Analyzer> analyzers = default(IList <Analyzer>), IList <Tokenizer> tokenizers = default(IList <Tokenizer>), IList <TokenFilter> tokenFilters = default(IList <TokenFilter>), IList <CharFilter> charFilters = default(IList <CharFilter>), string eTag = default(string)) { Name = name; Fields = fields; ScoringProfiles = scoringProfiles; DefaultScoringProfile = defaultScoringProfile; CorsOptions = corsOptions; Suggesters = suggesters; Analyzers = analyzers; Tokenizers = tokenizers; TokenFilters = tokenFilters; CharFilters = charFilters; ETag = eTag; }
/// <summary> /// Validate the object. /// </summary> /// <exception cref="ValidationException"> /// Thrown if validation fails /// </exception> public virtual void Validate() { if (Name == null) { throw new ValidationException(ValidationRules.CannotBeNull, "Name"); } if (Fields == null) { throw new ValidationException(ValidationRules.CannotBeNull, "Fields"); } if (Fields != null) { foreach (var element in Fields) { if (element != null) { element.Validate(); } } } if (ScoringProfiles != null) { foreach (var element1 in ScoringProfiles) { if (element1 != null) { element1.Validate(); } } } if (CorsOptions != null) { CorsOptions.Validate(); } if (Suggesters != null) { foreach (var element2 in Suggesters) { if (element2 != null) { element2.Validate(); } } } if (Analyzers != null) { foreach (var element3 in Analyzers) { if (element3 != null) { element3.Validate(); } } } if (Tokenizers != null) { foreach (var element4 in Tokenizers) { if (element4 != null) { element4.Validate(); } } } if (TokenFilters != null) { foreach (var element5 in TokenFilters) { if (element5 != null) { element5.Validate(); } } } if (CharFilters != null) { foreach (var element6 in CharFilters) { if (element6 != null) { element6.Validate(); } } } }