();
await WaitForIdle(obj, TimeSpan.FromSeconds(cslaOptions.DefaultWaitForIdleTimeoutInSeconds).ToCancellationToken()).ConfigureAwait(false);
}
@@ -92,8 +108,12 @@ protected async Task WaitForIdle(object obj)
/// Object on which to call the method.
/// The cancellation token.
/// void
+ /// is .
protected async Task WaitForIdle(object obj, CancellationToken ct)
{
+ if (obj is null)
+ throw new ArgumentNullException(nameof(obj));
+
if (obj is IDataPortalTarget target)
{
await target.WaitForIdle(ct).ConfigureAwait(false);
@@ -115,8 +135,12 @@ protected async Task WaitForIdle(object obj, CancellationToken ct)
///
/// Object on which to call the method.
///
+ /// is .
protected void MarkOld(object obj)
{
+ if (obj is null)
+ throw new ArgumentNullException(nameof(obj));
+
if (obj is IDataPortalTarget target)
target.MarkOld();
else
@@ -130,8 +154,12 @@ protected void MarkOld(object obj)
///
/// Object on which to call the method.
///
+ /// is .
protected void MarkNew(object obj)
{
+ if (obj is null)
+ throw new ArgumentNullException(nameof(obj));
+
if (obj is IDataPortalTarget target)
target.MarkNew();
else
@@ -145,8 +173,12 @@ protected void MarkNew(object obj)
///
/// Object on which to call the method.
///
+ /// is .
protected void MarkAsChild(object obj)
{
+ if (obj is null)
+ throw new ArgumentNullException(nameof(obj));
+
if (obj is IDataPortalTarget target)
target.MarkAsChild();
else
@@ -172,8 +204,14 @@ protected void MarkAsChild(object obj)
/// Loading values does not cause validation rules to be
/// invoked.
///
- protected void LoadProperty(object obj, PropertyInfo
propertyInfo, P newValue)
+ /// or is .
+ protected void LoadProperty
(object obj, PropertyInfo
propertyInfo, P? newValue)
{
+ if (obj is null)
+ throw new ArgumentNullException(nameof(obj));
+ if (propertyInfo is null)
+ throw new ArgumentNullException(nameof(propertyInfo));
+
if (obj is IManageProperties target)
target.LoadProperty
(propertyInfo, newValue);
else
@@ -218,8 +256,14 @@ protected void LoadProperty(object obj, IPropertyInfo propertyInfo, object? newV
///
/// No authorization checks occur when this method is called.
///
- protected P ReadProperty
(object obj, PropertyInfo
propertyInfo)
+ /// or is .
+ protected P? ReadProperty
(object obj, PropertyInfo
propertyInfo)
{
+ if (obj is null)
+ throw new ArgumentNullException(nameof(obj));
+ if (propertyInfo is null)
+ throw new ArgumentNullException(nameof(propertyInfo));
+
if (obj is IManageProperties target)
return target.ReadProperty(propertyInfo);
else
@@ -234,8 +278,14 @@ protected P ReadProperty
(object obj, PropertyInfo
propertyInfo)
///
/// No authorization checks occur when this method is called.
///
- protected object ReadProperty(object obj, IPropertyInfo propertyInfo)
+ /// or is .
+ protected object? ReadProperty(object obj, IPropertyInfo propertyInfo)
{
+ if (obj is null)
+ throw new ArgumentNullException(nameof(obj));
+ if (propertyInfo is null)
+ throw new ArgumentNullException(nameof(propertyInfo));
+
if (obj is IManageProperties target)
return target.ReadProperty(propertyInfo);
else
@@ -257,8 +307,12 @@ protected object ReadProperty(object obj, IPropertyInfo propertyInfo)
/// bypassing of normal authorization checks during
/// property setting.
///
+ /// is .
protected IDisposable BypassPropertyChecks(Csla.Core.BusinessBase businessObject)
{
+ if (businessObject is null)
+ throw new ArgumentNullException(nameof(businessObject));
+
return businessObject.BypassPropertyChecks;
}
@@ -268,8 +322,14 @@ protected IDisposable BypassPropertyChecks(Csla.Core.BusinessBase businessObject
///