|
3 | 3 |
|
4 | 4 | namespace Repository
|
5 | 5 | {
|
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> |
7 | 10 | public interface IRepository<T>
|
8 | 11 | {
|
| 12 | + /// <summary> |
| 13 | + /// Adds an entity to the repository |
| 14 | + /// </summary> |
| 15 | + /// <param name="entry">Entity to be added</param> |
| 16 | + /// <returns></returns> |
9 | 17 | public int Add(T entry);
|
10 | 18 |
|
| 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> |
11 | 24 | public T Get(int id);
|
12 | 25 |
|
| 26 | + /// <summary> |
| 27 | + /// Loads all entities from a repository |
| 28 | + /// </summary> |
| 29 | + /// <returns>Collection of all entities present in a repository</returns> |
13 | 30 | public List<T> GetAll();
|
14 | 31 |
|
| 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> |
15 | 37 | public bool Update(T entry);
|
16 | 38 |
|
| 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> |
17 | 44 | public bool Delete(T entry);
|
18 | 45 | }
|
19 | 46 |
|
| 47 | + /// <summary> |
| 48 | + /// A repository interface used for storing market orders |
| 49 | + /// </summary> |
20 | 50 | public interface IMarketOrderRepository : IRepository<MarketOrder>
|
21 | 51 | {
|
| 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> |
22 | 57 | 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); |
24 | 65 | }
|
25 | 66 |
|
| 67 | + /// <summary> |
| 68 | + /// A repository interface used for storing portfolios |
| 69 | + /// </summary> |
26 | 70 | public interface IPortfolioRepository : IRepository<Portfolio>
|
27 | 71 | {
|
28 | 72 | }
|
29 | 73 |
|
| 74 | + /// <summary> |
| 75 | + /// A repository interface used for storing portfolio entries |
| 76 | + /// </summary> |
30 | 77 | public interface IPortfolioEntryRepository : IRepository<PortfolioEntry>
|
31 | 78 | {
|
| 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> |
32 | 84 | public List<PortfolioEntry> GetAllByPortfolioId(int portfolioId);
|
33 | 85 |
|
| 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> |
34 | 91 | public int DeletePortfolioEntries(int portfolioId);
|
35 | 92 | }
|
36 | 93 | }
|
0 commit comments