1+ /*==============================================================================================================================
2+ | Author Ignia, LLC
3+ | Client Ignia, LLC
4+ | Project Topics Library
5+ \=============================================================================================================================*/
6+ using System . Data ;
7+
8+ namespace OnTopic . Data . Sql . Models {
9+
10+ /*============================================================================================================================
11+ | CLASS: TOPIC LIST (DATA TABLE)
12+ \---------------------------------------------------------------------------------------------------------------------------*/
13+ /// <summary>
14+ /// Extends <see cref="DataTable"/> to model the schema for the <c>TopicList</c> user-defined table type.
15+ /// </summary>
16+ internal class TopicListDataTable : DataTable {
17+
18+ /*==========================================================================================================================
19+ | CONSTRUCTOR
20+ \-------------------------------------------------------------------------------------------------------------------------*/
21+ /// <summary>
22+ /// Establishes a new <see cref="DataTable"/> with the appropriate schema for the <c>TopicList</c> user-defined
23+ /// table type.
24+ /// </summary>
25+ internal TopicListDataTable ( ) {
26+
27+ /*------------------------------------------------------------------------------------------------------------------------
28+ | COLUMN: Topic ID
29+ \-----------------------------------------------------------------------------------------------------------------------*/
30+ Columns . Add (
31+ new DataColumn ( "TopicID" , typeof ( int ) )
32+ ) ;
33+
34+ }
35+
36+ /*==========================================================================================================================
37+ | ADD ROW
38+ \-------------------------------------------------------------------------------------------------------------------------*/
39+ /// <summary>
40+ /// Provides a convenience method for adding a new <see cref="DataRow"/> based on the expected column values.
41+ /// </summary>
42+ internal DataRow AddRow ( int topicId ) {
43+
44+ /*------------------------------------------------------------------------------------------------------------------------
45+ | Define record
46+ \-----------------------------------------------------------------------------------------------------------------------*/
47+ var record = NewRow ( ) ;
48+ record [ "TopicID" ] = topicId ;
49+
50+ /*------------------------------------------------------------------------------------------------------------------------
51+ | Add record
52+ \-----------------------------------------------------------------------------------------------------------------------*/
53+ Rows . Add ( record ) ;
54+
55+ /*------------------------------------------------------------------------------------------------------------------------
56+ | Return record
57+ \-----------------------------------------------------------------------------------------------------------------------*/
58+ return record ;
59+
60+ }
61+
62+ } //Class
63+ } //Namespaces
0 commit comments