private static List <T> AddNew_AddingMethod <T>(string providerName, IEnumerable <T> dataset, bool suppressEventing, bool performForeignKeyIntegrityCheck, bool performValidation) where T : class, IData { Verify.ArgumentNotNullOrEmpty(providerName, "providerName"); Verify.ArgumentNotNull(dataset, "dataset"); Verify.ArgumentCondition(!dataset.Contains(null), "dataset", "The enumeration may not contain null values"); List <string> writeableProviders = DataProviderRegistry.GetWriteableDataProviderNamesByInterfaceType(typeof(T)); if (!writeableProviders.Contains(providerName)) { Log.LogVerbose(LogTitle, $"Type data interface '{typeof(T)}' is marked auto updateable and is not supported by the provider '{providerName}', adding it"); DynamicTypeManager.EnsureCreateStore(typeof(T), providerName); } writeableProviders = DataProviderRegistry.GetWriteableDataProviderNamesByInterfaceType(typeof(T)); if (!writeableProviders.Contains(providerName)) { throw new InvalidOperationException($"The writeable data providers '{providerName}' does not support the interface '{typeof(T)}'."); } foreach (T data in dataset) { if (performValidation) { CheckValidationResult(ValidationFacade.Validate <T>(data), typeof(T)); } if (performForeignKeyIntegrityCheck) { data.ValidateForeignKeyIntegrity(); } } if (!suppressEventing) { foreach (T data in dataset) { DataEventSystemFacade.FireDataBeforeAddEvent <T>(data); } } List <T> addedDataset = DataProviderPluginFacade.AddNew <T>(providerName, dataset); DataCachingFacade.AddDataToCache(addedDataset); if (!suppressEventing) { foreach (T data in addedDataset) { DataEventSystemFacade.FireDataAfterAddEvent <T>(data); } } return(addedDataset); }