public void Validate() { Contract.Requires(this.ProductVersion != null); string errorMessage; if (!OneDasUtilities.CheckNamingConvention(this.Id, out errorMessage)) { throw new Exception($"The ID is invalid: { errorMessage }"); } }
public void Validate() { IEnumerable <Guid> guidSet; string errorDescription; // -> naming convention if (!OneDasUtilities.CheckNamingConvention(this.Description.PrimaryGroupName, out errorDescription)) { throw new Exception(ErrorMessage.OneDasProject_PrimaryGroupNameInvalid); } if (!OneDasUtilities.CheckNamingConvention(this.Description.SecondaryGroupName, out errorDescription)) { throw new Exception(ErrorMessage.OneDasProject_SecondaryGroupNameInvalid); } if (!OneDasUtilities.CheckNamingConvention(this.Description.CampaignName, out errorDescription)) { throw new Exception(ErrorMessage.OneDasProject_CampaignNameInvalid); } if (!this.ChannelHubSettingsSet.ToList().TrueForAll(x => OneDasUtilities.CheckNamingConvention(x.Name, out errorDescription))) { throw new Exception(ErrorMessage.OneDasProject_ChannelHubNameInvalid); } // -> ChannelHub guidSet = this.ChannelHubSettingsSet.Select(x => x.Guid).ToList(); if (guidSet.Count() > guidSet.Distinct().Count()) { throw new Exception(ErrorMessage.OneDasProject_ChannelHubNotUnqiue); } // -> data gateway settings if (this.DataGatewaySettingsSet.Select(x => x.Description.InstanceId).Count() > this.DataGatewaySettingsSet.Select(x => x.Description.InstanceId).Distinct().Count()) { throw new Exception(ErrorMessage.OneDasProject_DataGatewaySettingsIdNotUnique); } this.DataGatewaySettingsSet.ToList().ForEach(dataGatewaySettings => dataGatewaySettings.Validate()); // -> data writer settings if (this.DataWriterSettingsSet.Select(x => x.Description.InstanceId).Count() > this.DataWriterSettingsSet.Select(x => x.Description.InstanceId).Distinct().Count()) { throw new Exception(ErrorMessage.OneDasProject_DataWriterSettingsIdNotUnique); } this.DataWriterSettingsSet.ToList().ForEach(dataWriterSettings => dataWriterSettings.Validate()); }
public DataWriterContext(string systemName, string dataDirectoryPath, OneDasCampaignDescription campaignDescription, IList <CustomMetadataEntry> customMetadataEntrySet) { Contract.Requires(customMetadataEntrySet != null); customMetadataEntrySet.ToList().ForEach(customMetaDataEntry => { if (!OneDasUtilities.CheckNamingConvention(customMetaDataEntry.Key, out errorDescription)) { throw new ArgumentException($"Argument '{ nameof(customMetadataEntrySet) }', value '{ customMetaDataEntry.Key }': { errorDescription }"); } }); this.SystemName = systemName; this.DataDirectoryPath = dataDirectoryPath; this.CampaignDescription = campaignDescription; this.CustomMetadataEntrySet = customMetadataEntrySet; }
public void Validate() { string errorMessage; if (!OneDasUtilities.CheckNamingConvention(this.ExtensionId, out errorMessage)) { throw new Exception($"The extension ID is invalid: { errorMessage }"); } if (this.InstanceId < 0) { throw new Exception(ErrorMessage.ActionRequest_InstanceIdInvalid); } if (!OneDasUtilities.CheckNamingConvention(this.MethodName, out errorMessage)) { throw new Exception($"The method name is invalid: { errorMessage }"); } }
public void Validate() { string errorMessage; if (this.Version < 0) { throw new Exception(ErrorMessage.OneDasCampaignDescription_InvalidVersion); } if (!OneDasUtilities.CheckNamingConvention(this.PrimaryGroupName, out errorMessage)) { throw new Exception($"The PrimaryGroupName is invalid: { errorMessage }"); } if (!OneDasUtilities.CheckNamingConvention(this.SecondaryGroupName, out errorMessage)) { throw new Exception($"The SecondaryGroupName is invalid: { errorMessage }"); } if (!OneDasUtilities.CheckNamingConvention(this.CampaignName, out errorMessage)) { throw new Exception($"The CampaignName is invalid: { errorMessage }"); } }