Skip to content

Commit

Permalink
Merge pull request rsm-hcd#17 from SaidShah/add-xml-comments-for-repo…
Browse files Browse the repository at this point in the history
…sitory-delete-conductor

Added XML comments to the repositoryDeleteConductor methods
  • Loading branch information
wintondeshong authored Sep 29, 2020
2 parents 554baa8 + b46036f commit 8b3ce9b
Show file tree
Hide file tree
Showing 2 changed files with 213 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@

## Contents

- [RepositoryDeleteConductor\`1](#T-AndcultureCode-CSharp-Conductors-RepositoryDeleteConductor`1 'AndcultureCode.CSharp.Conductors.RepositoryDeleteConductor`1')
- [#ctor(repository)](#M-AndcultureCode-CSharp-Conductors-RepositoryDeleteConductor`1-#ctor-AndcultureCode-CSharp-Core-Interfaces-Data-IRepository{`0}- 'AndcultureCode.CSharp.Conductors.RepositoryDeleteConductor`1.#ctor(AndcultureCode.CSharp.Core.Interfaces.Data.IRepository{`0})')
- [CommandTimeout](#P-AndcultureCode-CSharp-Conductors-RepositoryDeleteConductor`1-CommandTimeout 'AndcultureCode.CSharp.Conductors.RepositoryDeleteConductor`1.CommandTimeout')
- [BulkDelete(items,deletedById,soft)](#M-AndcultureCode-CSharp-Conductors-RepositoryDeleteConductor`1-BulkDelete-System-Collections-Generic-IEnumerable{`0},System-Nullable{System-Int64},System-Boolean- 'AndcultureCode.CSharp.Conductors.RepositoryDeleteConductor`1.BulkDelete(System.Collections.Generic.IEnumerable{`0},System.Nullable{System.Int64},System.Boolean)')
- [Delete(id,deletedById,soft)](#M-AndcultureCode-CSharp-Conductors-RepositoryDeleteConductor`1-Delete-System-Int64,System-Nullable{System-Int64},System-Boolean- 'AndcultureCode.CSharp.Conductors.RepositoryDeleteConductor`1.Delete(System.Int64,System.Nullable{System.Int64},System.Boolean)')
- [Delete(o,deletedById,soft)](#M-AndcultureCode-CSharp-Conductors-RepositoryDeleteConductor`1-Delete-`0,System-Nullable{System-Int64},System-Boolean- 'AndcultureCode.CSharp.Conductors.RepositoryDeleteConductor`1.Delete(`0,System.Nullable{System.Int64},System.Boolean)')
- [Delete(items,deletedById,batchSize,soft)](#M-AndcultureCode-CSharp-Conductors-RepositoryDeleteConductor`1-Delete-System-Collections-Generic-IEnumerable{`0},System-Nullable{System-Int64},System-Int64,System-Boolean- 'AndcultureCode.CSharp.Conductors.RepositoryDeleteConductor`1.Delete(System.Collections.Generic.IEnumerable{`0},System.Nullable{System.Int64},System.Int64,System.Boolean)')
- [Restore(o)](#M-AndcultureCode-CSharp-Conductors-RepositoryDeleteConductor`1-Restore-`0- 'AndcultureCode.CSharp.Conductors.RepositoryDeleteConductor`1.Restore(`0)')
- [Restore(id)](#M-AndcultureCode-CSharp-Conductors-RepositoryDeleteConductor`1-Restore-System-Int64- 'AndcultureCode.CSharp.Conductors.RepositoryDeleteConductor`1.Restore(System.Int64)')
- [RepositoryReadConductor\`1](#T-AndcultureCode-CSharp-Conductors-RepositoryReadConductor`1 'AndcultureCode.CSharp.Conductors.RepositoryReadConductor`1')
- [#ctor(repository)](#M-AndcultureCode-CSharp-Conductors-RepositoryReadConductor`1-#ctor-AndcultureCode-CSharp-Core-Interfaces-Data-IRepository{`0}- 'AndcultureCode.CSharp.Conductors.RepositoryReadConductor`1.#ctor(AndcultureCode.CSharp.Core.Interfaces.Data.IRepository{`0})')
- [CommandTimeout](#P-AndcultureCode-CSharp-Conductors-RepositoryReadConductor`1-CommandTimeout 'AndcultureCode.CSharp.Conductors.RepositoryReadConductor`1.CommandTimeout')
Expand All @@ -21,6 +30,154 @@
- [Update(item,updatedBy)](#M-AndcultureCode-CSharp-Conductors-RepositoryUpdateConductor`1-Update-`0,System-Nullable{System-Int64}- 'AndcultureCode.CSharp.Conductors.RepositoryUpdateConductor`1.Update(`0,System.Nullable{System.Int64})')
- [Update(items,updatedBy)](#M-AndcultureCode-CSharp-Conductors-RepositoryUpdateConductor`1-Update-System-Collections-Generic-IEnumerable{`0},System-Nullable{System-Int64}- 'AndcultureCode.CSharp.Conductors.RepositoryUpdateConductor`1.Update(System.Collections.Generic.IEnumerable{`0},System.Nullable{System.Int64})')

<a name='T-AndcultureCode-CSharp-Conductors-RepositoryDeleteConductor`1'></a>
## RepositoryDeleteConductor\`1 `type`

##### Namespace

AndcultureCode.CSharp.Conductors

##### Summary

Ability to delete an entity or list of entities

##### Generic Types

| Name | Description |
| ---- | ----------- |
| T | |

<a name='M-AndcultureCode-CSharp-Conductors-RepositoryDeleteConductor`1-#ctor-AndcultureCode-CSharp-Core-Interfaces-Data-IRepository{`0}-'></a>
### #ctor(repository) `constructor`

##### Summary

Constructor

##### Parameters

| Name | Type | Description |
| ---- | ---- | ----------- |
| repository | [AndcultureCode.CSharp.Core.Interfaces.Data.IRepository{\`0}](#T-AndcultureCode-CSharp-Core-Interfaces-Data-IRepository{`0} 'AndcultureCode.CSharp.Core.Interfaces.Data.IRepository{`0}') | |

<a name='P-AndcultureCode-CSharp-Conductors-RepositoryDeleteConductor`1-CommandTimeout'></a>
### CommandTimeout `property`

##### Summary

Ability to set and get the underlying DbContext's command timeout

<a name='M-AndcultureCode-CSharp-Conductors-RepositoryDeleteConductor`1-BulkDelete-System-Collections-Generic-IEnumerable{`0},System-Nullable{System-Int64},System-Boolean-'></a>
### BulkDelete(items,deletedById,soft) `method`

##### Summary

Ability to delete a list of entities in a single bulk operation.

##### Returns



##### Parameters

| Name | Type | Description |
| ---- | ---- | ----------- |
| items | [System.Collections.Generic.IEnumerable{\`0}](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Collections.Generic.IEnumerable 'System.Collections.Generic.IEnumerable{`0}') | List of items to delete |
| deletedById | [System.Nullable{System.Int64}](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Nullable 'System.Nullable{System.Int64}') | Id of user deleting the items |
| soft | [System.Boolean](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Boolean 'System.Boolean') | Boolean flag for soft-deleting items |

<a name='M-AndcultureCode-CSharp-Conductors-RepositoryDeleteConductor`1-Delete-System-Int64,System-Nullable{System-Int64},System-Boolean-'></a>
### Delete(id,deletedById,soft) `method`

##### Summary

Ability to delete an entity using an Id

##### Returns



##### Parameters

| Name | Type | Description |
| ---- | ---- | ----------- |
| id | [System.Int64](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Int64 'System.Int64') | Id of item to be deleted |
| deletedById | [System.Nullable{System.Int64}](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Nullable 'System.Nullable{System.Int64}') | Id of user deleting the item |
| soft | [System.Boolean](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Boolean 'System.Boolean') | Boolean flag for soft-deleting the item |

<a name='M-AndcultureCode-CSharp-Conductors-RepositoryDeleteConductor`1-Delete-`0,System-Nullable{System-Int64},System-Boolean-'></a>
### Delete(o,deletedById,soft) `method`

##### Summary

Ability to delete an entity using the entity itself

##### Returns



##### Parameters

| Name | Type | Description |
| ---- | ---- | ----------- |
| o | [\`0](#T-`0 '`0') | Item to be deleted |
| deletedById | [System.Nullable{System.Int64}](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Nullable 'System.Nullable{System.Int64}') | Id of user deleting the item |
| soft | [System.Boolean](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Boolean 'System.Boolean') | Boolean flag for soft-deleting the item |

<a name='M-AndcultureCode-CSharp-Conductors-RepositoryDeleteConductor`1-Delete-System-Collections-Generic-IEnumerable{`0},System-Nullable{System-Int64},System-Int64,System-Boolean-'></a>
### Delete(items,deletedById,batchSize,soft) `method`

##### Summary

Ability to delete a list of entities by batch size.

##### Returns



##### Parameters

| Name | Type | Description |
| ---- | ---- | ----------- |
| items | [System.Collections.Generic.IEnumerable{\`0}](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Collections.Generic.IEnumerable 'System.Collections.Generic.IEnumerable{`0}') | List of items to delete |
| deletedById | [System.Nullable{System.Int64}](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Nullable 'System.Nullable{System.Int64}') | Id of user deleting the items |
| batchSize | [System.Int64](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Int64 'System.Int64') | Number of items to include in a batch, defaults to 100 |
| soft | [System.Boolean](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Boolean 'System.Boolean') | Boolean flag for soft-deleting the items |

<a name='M-AndcultureCode-CSharp-Conductors-RepositoryDeleteConductor`1-Restore-`0-'></a>
### Restore(o) `method`

##### Summary

Ability to restore a soft-deleted entity using the entity itself.

##### Returns



##### Parameters

| Name | Type | Description |
| ---- | ---- | ----------- |
| o | [\`0](#T-`0 '`0') | Entity to be restored |

<a name='M-AndcultureCode-CSharp-Conductors-RepositoryDeleteConductor`1-Restore-System-Int64-'></a>
### Restore(id) `method`

##### Summary

Ability to restore a soft-deleted entity using the entity id.

##### Returns



##### Parameters

| Name | Type | Description |
| ---- | ---- | ----------- |
| id | [System.Int64](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Int64 'System.Int64') | Id of entity to be restored |

<a name='T-AndcultureCode-CSharp-Conductors-RepositoryReadConductor`1'></a>
## RepositoryReadConductor\`1 `type`

Expand Down
60 changes: 56 additions & 4 deletions src/AndcultureCode.CSharp.Conductors/RepositoryDeleteConductor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,18 @@

namespace AndcultureCode.CSharp.Conductors
{
/// <summary>
/// Ability to delete an entity or list of entities
/// </summary>
/// <typeparam name="T"></typeparam>
public class RepositoryDeleteConductor<T> : Conductor, IRepositoryDeleteConductor<T>
where T : class, IEntity
{
#region Properties

/// <summary>
/// Ability to set and get the underlying DbContext's command timeout
/// </summary>
public int? CommandTimeout
{
get => _repository.CommandTimeout;
Expand All @@ -24,6 +31,10 @@ public int? CommandTimeout

#region Constructor

/// <summary>
/// Constructor
/// </summary>
/// <param name="repository"></param>
public RepositoryDeleteConductor(IRepository<T> repository)
{
_repository = repository;
Expand All @@ -33,14 +44,55 @@ public RepositoryDeleteConductor(IRepository<T> repository)


#region IRepositoryDeleteConductor Implementation

/// <summary>
/// Ability to delete a list of entities in a single bulk operation.
/// </summary>
/// <param name="items">List of items to delete</param>
/// <param name="deletedById">Id of user deleting the items</param>
/// <param name="soft">Boolean flag for soft-deleting items</param>
/// <returns></returns>
public virtual IResult<bool> BulkDelete(IEnumerable<T> items, long? deletedById = default(long?), bool soft = true) => _repository.BulkDelete(items, deletedById, soft);

/// <summary>
/// Ability to delete an entity using an Id
/// </summary>
/// <param name="id">Id of item to be deleted</param>
/// <param name="deletedById">Id of user deleting the item</param>
/// <param name="soft">Boolean flag for soft-deleting the item</param>
/// <returns></returns>
public virtual IResult<bool> Delete(long id, long? deletedById = default(long?), bool soft = true) => _repository.Delete(id, deletedById, soft);
public virtual IResult<bool> Delete(T o, long? deletedById = default(long?), bool soft = true) => _repository.Delete(o, deletedById, soft);
public virtual IResult<bool> Delete(IEnumerable<T> items ,long? deletedById = default(long?), long batchSize = 100, bool soft = true) => _repository.Delete(items, deletedById, batchSize, soft);

public virtual IResult<bool> Restore(T o) => _repository.Restore(o);
/// <summary>
/// Ability to delete an entity using the entity itself
/// </summary>
/// <param name="o">Item to be deleted</param>
/// <param name="deletedById">Id of user deleting the item</param>
/// <param name="soft">Boolean flag for soft-deleting the item</param>
/// <returns></returns>
public virtual IResult<bool> Delete(T o, long? deletedById = default(long?), bool soft = true) => _repository.Delete(o, deletedById, soft);

/// <summary>
/// Ability to delete a list of entities by batch size.
/// </summary>
/// <param name="items">List of items to delete</param>
/// <param name="deletedById">Id of user deleting the items</param>
/// <param name="batchSize">Number of items to include in a batch, defaults to 100</param>
/// <param name="soft">Boolean flag for soft-deleting the items</param>
/// <returns></returns>
public virtual IResult<bool> Delete(IEnumerable<T> items, long? deletedById = default(long?), long batchSize = 100, bool soft = true) => _repository.Delete(items, deletedById, batchSize, soft);

/// <summary>
/// Ability to restore a soft-deleted entity using the entity itself.
/// </summary>
/// <param name="o">Entity to be restored</param>
/// <returns></returns>
public virtual IResult<bool> Restore(T o) => _repository.Restore(o);

/// <summary>
/// Ability to restore a soft-deleted entity using the entity id.
/// </summary>
/// <param name="id">Id of entity to be restored</param>
/// <returns></returns>
public virtual IResult<bool> Restore(long id) => _repository.Restore(id);

#endregion IRepositoryDeleteConductor Implementation
Expand Down

0 comments on commit 8b3ce9b

Please sign in to comment.