Skip to content

Commit 6d12b2b

Browse files
committed
Added documentation to the IRepository.cs file
1 parent 3d2a14a commit 6d12b2b

File tree

2 files changed

+61
-4
lines changed

2 files changed

+61
-4
lines changed

Repository/IRepository.cs

Lines changed: 59 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,91 @@
33

44
namespace Repository
55
{
6-
// TODO comments
6+
/// <summary>
7+
/// An interface that represents a general repository for storing entities to a persistent storage
8+
/// </summary>
9+
/// <typeparam name="T">Type of the entity to be used</typeparam>
710
public interface IRepository<T>
811
{
12+
/// <summary>
13+
/// Adds an entity to the repository
14+
/// </summary>
15+
/// <param name="entry">Entity to be added</param>
16+
/// <returns></returns>
917
public int Add(T entry);
1018

19+
/// <summary>
20+
/// Loads an entity specified by an ID from a repository
21+
/// </summary>
22+
/// <param name="id">ID of the entity to be loaded</param>
23+
/// <returns>Found entity or null</returns>
1124
public T Get(int id);
1225

26+
/// <summary>
27+
/// Loads all entities from a repository
28+
/// </summary>
29+
/// <returns>Collection of all entities present in a repository</returns>
1330
public List<T> GetAll();
1431

32+
/// <summary>
33+
/// Saves the updated version of an entity to the database overriding it's previous version
34+
/// </summary>
35+
/// <param name="entry">Updated version of already an entity already existing in the repository</param>
36+
/// <returns>A flag indicating whether the update was successful</returns>
1537
public bool Update(T entry);
1638

39+
/// <summary>
40+
/// Deletes the given entity from the repository
41+
/// </summary>
42+
/// <param name="entry">An entity to be deleted from the repository</param>
43+
/// <returns>A flag indicating whether the entity was deleted successfully</returns>
1744
public bool Delete(T entry);
1845
}
1946

47+
/// <summary>
48+
/// A repository interface used for storing market orders
49+
/// </summary>
2050
public interface IMarketOrderRepository : IRepository<MarketOrder>
2151
{
52+
/// <summary>
53+
/// Gets all market orders of a portfolio entry
54+
/// </summary>
55+
/// <param name="portfolioEntryId">ID of the entry whose orders should be loaded</param>
56+
/// <returns>A collection of all orders assigned to the portfolio entry</returns>
2257
public List<MarketOrder> GetAllByPortfolioEntryId(int portfolioEntryId);
23-
public int DeletePortfolioEntryOrders(int portfolioEntryOrder);
58+
59+
/// <summary>
60+
/// Deletes all market orders of the portfolio entry given by an ID
61+
/// </summary>
62+
/// <param name="portfolioEntryId">ID of the entry whose orders should be deleted</param>
63+
/// <returns>A flag indicating whether the orders have been successfully deleted</returns>
64+
public int DeletePortfolioEntryOrders(int portfolioEntryId);
2465
}
2566

67+
/// <summary>
68+
/// A repository interface used for storing portfolios
69+
/// </summary>
2670
public interface IPortfolioRepository : IRepository<Portfolio>
2771
{
2872
}
2973

74+
/// <summary>
75+
/// A repository interface used for storing portfolio entries
76+
/// </summary>
3077
public interface IPortfolioEntryRepository : IRepository<PortfolioEntry>
3178
{
79+
/// <summary>
80+
/// Gets all portfolio entries of a portfolio given by an ID
81+
/// </summary>
82+
/// <param name="portfolioId">ID of the portfolio whose entries should be loaded</param>
83+
/// <returns>A collection of all portfolio entries assigned to the portfolio</returns>
3284
public List<PortfolioEntry> GetAllByPortfolioId(int portfolioId);
3385

86+
/// <summary>
87+
/// Deletes all portfolio entries of the portfolio given by an ID
88+
/// </summary>
89+
/// <param name="portfolioId">ID of the portfolio whose entries should be deleted</param>
90+
/// <returns>A flag indicating whether the entries have been succesfully deleted</returns>
3491
public int DeletePortfolioEntries(int portfolioId);
3592
}
3693
}

Repository/SqlKataMarketOrderRepository.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public override MarketOrder FromRow(dynamic d) =>
3838
public List<MarketOrder> GetAllByPortfolioEntryId(int portfolioEntryId) =>
3939
RowsToObjects(Db.Get().Query(tableName).Where(SqlSchema.MarketOrdersPortfolioEntryId, portfolioEntryId).Get());
4040

41-
public int DeletePortfolioEntryOrders(int portfolioEntryOrder) =>
42-
Db.Get().Query(tableName).Where(SqlSchema.MarketOrdersPortfolioEntryId, portfolioEntryOrder).Delete();
41+
public int DeletePortfolioEntryOrders(int portfolioEntryId) =>
42+
Db.Get().Query(tableName).Where(SqlSchema.MarketOrdersPortfolioEntryId, portfolioEntryId).Delete();
4343
}
4444
}

0 commit comments

Comments
 (0)