示例#1
0
文件: Index.cs 项目: vtherry/autorest
 /// <summary>
 /// Initializes a new instance of the Index class.
 /// </summary>
 /// <param name="name">Gets or sets the name of the index.</param>
 /// <param name="fields">Gets or sets the fields of the index.</param>
 /// <param name="scoringProfiles">Gets or sets the scoring profiles for
 /// the index.</param>
 /// <param name="defaultScoringProfile">Gets or sets the name of the
 /// scoring profile to use if none is specified in the query. If this
 /// property is not set and no scoring profile is specified in the
 /// query, then default scoring (tf-idf) will be used.</param>
 /// <param name="corsOptions">Gets or sets options to control
 /// Cross-Origin Resource Sharing (CORS) for the index.</param>
 /// <param name="suggesters">Gets or sets the suggesters for the
 /// index.</param>
 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>))
 {
     Name                  = name;
     Fields                = fields;
     ScoringProfiles       = scoringProfiles;
     DefaultScoringProfile = defaultScoringProfile;
     CorsOptions           = corsOptions;
     Suggesters            = suggesters;
     CustomInit();
 }
示例#2
0
文件: Index.cs 项目: vtherry/autorest
 /// <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();
             }
         }
     }
 }