FAQ Components
The C# code for our FAQ module will reside in the Engine\Modules\Faqs
directory. First, we will write out helper components and place these in a Components
directory. Each module in the CSK places components inside a distinct namespace below ASPNET.StarterKit.Communities
, and the existing modules use the name of the module as the additional namespace qualifier (Faqs
).
FaqInfo
FaqInfo
class extends the ContentInfo
class to offer data properties specific to an FAQ. The code for this class is shown as follows:
using System; using System.Data.SqlClient; namespace ASPNET.StarterKit.Communities.Faqs { public class FaqInfo : ContentInfo { public FaqInfo(SqlDataReader dr) : base(dr) { if(dr["Faq_Answer"] != DBNull.Value) { _answerText = (string)dr["Faq_Answer"]; } if(dr["Faq_Reference"] != DBNull.Value) { _referenceText = (string)dr["Faq_Reference"]; } } public string AnswerText { get { return _answerText; } set { _answerText = value; } } public string ReferenceText { get { return...