Class InfoProviderBulkExtensions
- Namespace
- CMS.DataEngine
- Assembly
- CMS.DataEngine.dll
Contains extension methods for bulk operations for IInfoProvider<TInfo>.
public static class InfoProviderBulkExtensions
- Inheritance
-
objectInfoProviderBulkExtensions
Methods
BulkDelete<TInfo>(IInfoProvider<TInfo>, IWhereCondition, BulkDeleteSettings)
Bulk deletes info objects based on the given condition if the provider supports bulk operations.
public static void BulkDelete<TInfo>(this IInfoProvider<TInfo> infoProvider, IWhereCondition where, BulkDeleteSettings settings = null) where TInfo : AbstractInfoBase<TInfo>, new()
Parameters
infoProviderIInfoProvider<TInfo>TInfoprovider to use to bulk delete the info objects.whereIWhereConditionWhere condition filtering the objects to be deleted, or null.
settingsBulkDeleteSettingsConfiguration for the bulk delete. If null, default configuration is used.
Type Parameters
TInfoType of info object managed by the provider.
Remarks
Note that the delete process of individual object types within dependencies does not run within transaction. If it fails, some data may be cleared and not rolled back. If you require transaction, wrap the call of this method to CMSTransactionScope.
Method is not executing any customizations for remove dependencies routine (custom code in RemoveObjectDependencies(bool, bool) or 'removedependencies' query). All customizations must be called prior this method or handled within BulkDelete event.
Exceptions
- ArgumentNullException
Thrown when
infoProvideris null.- NotSupportedException
Thrown when
infoProviderdoes not implement IBulkInfoProvider<TInfo>.
BulkInsert<TInfo>(IInfoProvider<TInfo>, IEnumerable<TInfo>, BulkInsertSettings)
Bulk inserts an enumerable of TInfo if the provider supports bulk operations.
public static void BulkInsert<TInfo>(this IInfoProvider<TInfo> infoProvider, IEnumerable<TInfo> objects, BulkInsertSettings settings = null) where TInfo : AbstractInfoBase<TInfo>, new()
Parameters
infoProviderIInfoProvider<TInfo>TInfoprovider to use to bulk insert the info objects.objectsIEnumerable<TInfo>Enumerable of
TInfoto be inserted.settingsBulkInsertSettingsConfiguration for the bulk insert, e.g. timeout. If null, default configuration is used.
Type Parameters
TInfoType of info object managed by the provider.
Remarks
Info object ID is not set during the bulk insert operation.
Exceptions
- ArgumentNullException
Thrown when
infoProviderorobjectsis null.- NotSupportedException
Thrown when
infoProviderdoes not implement IBulkInfoProvider<TInfo>.
BulkUpdate<TInfo>(IInfoProvider<TInfo>, IEnumerable<KeyValuePair<string, object>>, IWhereCondition, bool)
Bulk updates info objects based on the given condition using the values provided if the provider supports bulk operations.
public static void BulkUpdate<TInfo>(this IInfoProvider<TInfo> infoProvider, IEnumerable<KeyValuePair<string, object>> values, IWhereCondition where, bool useApi = false) where TInfo : AbstractInfoBase<TInfo>, new()
Parameters
infoProviderIInfoProvider<TInfo>TInfoprovider to use to bulk update the info objects.valuesIEnumerable<KeyValuePair<string, object>>New values for the data as an enumeration of column names and their corresponding values.
whereIWhereConditionWhere condition filtering the objects to be updated, or null.
useApiboolSpecifies whether to perform the update using the API, or using a DB query.
Type Parameters
TInfoType of info object managed by the provider.
Exceptions
- ArgumentNullException
Thrown when
infoProviderorvaluesis null.- NotSupportedException
Thrown when
infoProviderdoes not implement IBulkInfoProvider<TInfo>.
BulkUpdate<TInfo>(IInfoProvider<TInfo>, string, QueryDataParameters, IWhereCondition)
Bulk updates info objects based on the given condition using the updateExpression provided if the provider supports bulk operations.
public static void BulkUpdate<TInfo>(this IInfoProvider<TInfo> infoProvider, string updateExpression, QueryDataParameters updateParameters, IWhereCondition where) where TInfo : AbstractInfoBase<TInfo>, new()
Parameters
infoProviderIInfoProvider<TInfo>TInfoprovider to use to bulk update the info objects.updateExpressionstringUpdate expression (e.g.
[Column] = [Column] * 2or[Column] = @ParameterValue).updateParametersQueryDataParametersParameters for the update expression, or null.
whereIWhereConditionWhere condition filtering the objects to be updated, or null.
Type Parameters
TInfoType of info object managed by the provider.
Remarks
It is strongly recommended to use query data parameters for specifying values for the update expression to prevent possible vulnerabilities.
Exceptions
- ArgumentNullException
Thrown when
infoProvideris null.- ArgumentException
Thrown when
updateExpressionis null or empty.- NotSupportedException
Thrown when
infoProviderdoes not implement IBulkInfoProvider<TInfo>.