| @@ -32,10 +32,11 @@ using System.Security.Claims; · 31 unmodified lines |
| 32 | 32 | using System.Web.Http; |
| 33 | 33 | using GSF.Data; |
| 34 | 34 | using GSF.Data.Model; |
| 35 | | −using GSF.Reflection; |
| 36 | 35 | using Newtonsoft.Json; |
| 37 | 36 | using Newtonsoft.Json.Linq; |
| 38 | 37 | |
| 38 | +#pragma warning disable CS1591 // TODO: Fix missing XML comments for publicly visible types and members |
| 39 | + |
| 39 | 40 | namespace GSF.Web.Model |
| 40 | 41 | { |
| 41 | 42 | /// <summary> |
| @@ -45,6 +46,7 @@ namespace GSF.Web.Model · 3 unmodified lines |
| 45 | 46 | public class ModelController<T> : ApiController where T : class, new() |
| 46 | 47 | { |
| 47 | 48 | #region [ Members ] |
| 49 | + |
| 48 | 50 | /// <summary> |
| 49 | 51 | /// Class Providing Search Parameters for the Search Endpoints |
| 50 | 52 | /// </summary> |
| @@ -223,10 +225,10 @@ namespace GSF.Web.Model · 172 unmodified lines |
| 223 | 225 | } |
| 224 | 226 | |
| 225 | 227 | /// <summary> |
| 226 | | − /// Gets record from associated table with a primary key matching the id provided |
| 228 | + /// Gets record from associated table with a primary key matching the <paramref name="id"/> provided. |
| 227 | 229 | /// </summary> |
| 228 | 230 | /// <param name="id">ID to be used</param> |
| 229 | | − /// <returns><see cref="IHttpActionResult"/> containing <see cref="T"/> or <see cref="Exception"/></returns> |
| 231 | + /// <returns><see cref="IHttpActionResult"/> containing <typeparamref name="T"/> or <see cref="Exception"/></returns> |
| 230 | 232 | [HttpGet, Route("One/{id}")] |
| 231 | 233 | public virtual IHttpActionResult GetOne(string id) |
| 232 | 234 | { |
| @@ -266,7 +268,7 @@ namespace GSF.Web.Model · 33 unmodified lines |
| 266 | 268 | } |
| 267 | 269 | |
| 268 | 270 | /// <summary> |
| 269 | | − /// Gets a sorted list of <see cref="T"/>. |
| 271 | + /// Gets a sorted list of <typeparamref name="T"/>. |
| 270 | 272 | /// </summary> |
| 271 | 273 | /// <param name="sort"> the Field to be sorted by.</param> |
| 272 | 274 | /// <param name="ascending"> parameter to indicate whether the list is in ascending order.</param> |
| @@ -345,7 +347,7 @@ namespace GSF.Web.Model · 72 unmodified lines |
| 345 | 347 | /// <summary> |
| 346 | 348 | /// Adds a new Record. |
| 347 | 349 | /// </summary> |
| 348 | | − /// <param name="record"> The <see cref="T"/> record to be added.</param> |
| 350 | + /// <param name="record"> The <typeparamref name="T"/> record to be added.</param> |
| 349 | 351 | /// <returns><see cref="IHttpActionResult"/> containing the added record or <see cref="Exception"/> </returns> |
| 350 | 352 | [HttpPost, Route("Add")] |
| 351 | 353 | public virtual IHttpActionResult Post([FromBody] JObject record) |
| @@ -378,7 +380,7 @@ namespace GSF.Web.Model · 26 unmodified lines |
| 378 | 380 | /// <summary> |
| 379 | 381 | /// Updates an existing Record. |
| 380 | 382 | /// </summary> |
| 381 | | − /// <param name="record"> The <see cref="T"/> record to be updated.</param> |
| 383 | + /// <param name="record"> The <typeparamref name="T"/> record to be updated.</param> |
| 382 | 384 | /// <returns><see cref="IHttpActionResult"/> containing the updated record or <see cref="Exception"/> </returns> |
| 383 | 385 | |
| 384 | 386 | [HttpPatch, Route("Update")] |
| @@ -424,7 +426,7 @@ namespace GSF.Web.Model · 39 unmodified lines |
| 424 | 426 | /// <summary> |
| 425 | 427 | /// Deletes an existing Record. |
| 426 | 428 | /// </summary> |
| 427 | | − /// <param name="record"> The <see cref="T"/> record to be deleted.</param> |
| 429 | + /// <param name="record"> The <typeparamref name="T"/> record to be deleted.</param> |
| 428 | 430 | /// <returns><see cref="IHttpActionResult"/> containing the number of records deleted or <see cref="Exception"/> </returns> |
| 429 | 431 | |
| 430 | 432 | [HttpDelete, Route("Delete")] |
| @@ -481,7 +483,7 @@ namespace GSF.Web.Model · 50 unmodified lines |
| 481 | 483 | } |
| 482 | 484 | |
| 483 | 485 | /// <summary> |
| 484 | | − /// Gets all records from associated table, filtered and sorted as defined in <see cref="postData"/>. |
| 486 | + /// Gets all records from associated table, filtered and sorted as defined in <paramref name="postData"/>. |
| 485 | 487 | /// </summary> |
| 486 | 488 | /// <param name="postData"><see cref="PostData"/> containing the search and sort parameters</param> |
| 487 | 489 | /// <returns><see cref="IHttpActionResult"/> containing <see cref="IEnumerable{T}"/> or <see cref="Exception"/></returns> |
| @@ -733,7 +735,7 @@ namespace GSF.Web.Model · 245 unmodified lines |
| 733 | 735 | SELECT |
| 734 | 736 | SRC.*, |
| 735 | 737 | ''AFV_'' + AF.{SearchSettings.FieldKeyField} AS AFFieldKey, |
| 736 | | − AF.{SearchSettings.ValueField} AS AFValue |
| 738 | + AF.{SearchSettings.ValueField} AS AFValue |
| 737 | 739 | FROM {tableName} SRC LEFT JOIN |
| 738 | 740 | {SearchSettings.AdditionalFieldTable} AF ON {joinCondition} |
| 739 | 741 | ) as FullTbl ' + (SELECT CASE WHEN Len(@PivotColumns) > 0 THEN 'PIVOT ( |
| @@ -743,9 +745,9 @@ namespace GSF.Web.Model · 3 unmodified lines |
| 743 | 745 | DECLARE @NoNPivotColumns NVARCHAR(MAX) = N'''' |
| 744 | 746 | SELECT @NoNPivotColumns = @NoNPivotColumns + ''[''+ name + ''],'' |
| 745 | 747 | FROM tempdb.sys.columns WHERE object_id = Object_id(''tempdb..#Tbl'') AND name NOT LIKE ''AFV%''; |
| 746 | | − DECLARE @CleanSQL NVARCHAR(MAX) = N''SELECT '' + SUBSTRING(@NoNPivotColumns,0, LEN(@NoNPivotColumns)) + ''FROM #Tbl ORDER BY { postData.OrderBy} {(postData.Ascending ? "ASC" : "DESC")}'' |
| 748 | + DECLARE @CleanSQL NVARCHAR(MAX) = N''SELECT '' + SUBSTRING(@NoNPivotColumns,0, LEN(@NoNPivotColumns)) + ''FROM #Tbl ORDER BY { postData.OrderBy} {(postData.Ascending ? "ASC" : "DESC")}'' |
| 747 | 749 | |
| 748 | | − exec sp_executesql @CleanSQL |
| 750 | + exec sp_executesql @CleanSQL |
| 749 | 751 | ' |
| 750 | 752 | exec sp_executesql @SQLStatement"; |
| 751 | 753 | else |
| @@ -759,7 +761,7 @@ namespace GSF.Web.Model · 7 unmodified lines |
| 759 | 761 | SELECT |
| 760 | 762 | SRC.*, |
| 761 | 763 | ''AFV_'' + AF.{SearchSettings.FieldKeyField} AS AFFieldKey, |
| 762 | | − AF.{SearchSettings.ValueField} AS AFValue |
| 764 | + AF.{SearchSettings.ValueField} AS AFValue |
| 763 | 765 | FROM ({CustomView.Replace("'", "''")}) SRC LEFT JOIN |
| 764 | 766 | {SearchSettings.AdditionalFieldTable} AF ON {joinCondition} |
| 765 | 767 | ) as FullTbl ' + (SELECT CASE WHEN Len(@PivotColumns) > 0 THEN 'PIVOT ( |
| @@ -769,9 +771,9 @@ namespace GSF.Web.Model · 3 unmodified lines |
| 769 | 771 | DECLARE @NoNPivotColumns NVARCHAR(MAX) = N'''' |
| 770 | 772 | SELECT @NoNPivotColumns = @NoNPivotColumns + ''[''+ name + ''],'' |
| 771 | 773 | FROM tempdb.sys.columns WHERE object_id = Object_id(''tempdb..#Tbl'') AND name NOT LIKE ''AFV%''; |
| 772 | | − DECLARE @CleanSQL NVARCHAR(MAX) = N''SELECT '' + SUBSTRING(@NoNPivotColumns,0, LEN(@NoNPivotColumns)) + ''FROM #Tbl ORDER BY { postData.OrderBy} {(postData.Ascending ? "ASC" : "DESC")}'' |
| 774 | + DECLARE @CleanSQL NVARCHAR(MAX) = N''SELECT '' + SUBSTRING(@NoNPivotColumns,0, LEN(@NoNPivotColumns)) + ''FROM #Tbl ORDER BY { postData.OrderBy} {(postData.Ascending ? "ASC" : "DESC")}'' |
| 773 | 775 | |
| 774 | | − exec sp_executesql @CleanSQL |
| 776 | + exec sp_executesql @CleanSQL |
| 775 | 777 | ' |
| 776 | 778 | exec sp_executesql @SQLStatement"; |
| 777 | 779 | } |