/// <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 (TimeWindow != null) { TimeWindow.Validate(); } if (Audience != null) { Audience.Validate(); } if (BrowserRestrictions != null) { foreach (var element in BrowserRestrictions) { if (element != null) { element.Validate(); } } } }
/// <summary> /// Initializes a new instance of the Feature class. /// </summary> public Feature(string name, System.Guid?id = default(System.Guid?), string description = default(string), bool?isEnabled = default(bool?), bool?isArchived = default(bool?), bool?alwaysOn = default(bool?), bool?alwaysOff = default(bool?), TimeWindow timeWindow = default(TimeWindow), RolloutPercentage rolloutPercentage = default(RolloutPercentage), Audience audience = default(Audience), IList <BrowserRestriction> browserRestrictions = default(IList <BrowserRestriction>), bool?hasFallbackFeature = default(bool?), string createdBy = default(string), System.DateTimeOffset?createdOn = default(System.DateTimeOffset?), string modifiedBy = default(string), System.DateTimeOffset?modifiedOn = default(System.DateTimeOffset?)) { Id = id; Name = name; Description = description; IsEnabled = isEnabled; IsArchived = isArchived; AlwaysOn = alwaysOn; AlwaysOff = alwaysOff; TimeWindow = timeWindow; RolloutPercentage = rolloutPercentage; Audience = audience; BrowserRestrictions = browserRestrictions; HasFallbackFeature = hasFallbackFeature; CreatedBy = createdBy; CreatedOn = createdOn; ModifiedBy = modifiedBy; ModifiedOn = modifiedOn; CustomInit(); }