App_Code/Sections/Section.cs

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

//===============================================================================================
//
// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Permissive License.
// See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx.
// All other rights reserved.
//
//===============================================================================================

using System;
using System.Collections.Generic;

namespace MyWebPagesStarterKit
{
    /// <summary>
    /// Base class for all sections. Encapsulates the general section properties and methods.
    /// </summary>
    /// <typeparam name="T">Type of the section-data class (this type is just passed to Persistable&lt;T&gt;)
    public abstract class Section<T> : Persistable<T>, ISection
    {
        private string _sectionId;

        /// <summary>
        /// Creates a new section with a new section id (guid)
        /// </summary>
        public Section() : base()
        {
            _sectionId = Guid.NewGuid().ToString();
        }

        /// <summary>
        /// Creates a section with the given section id. The data is loaded form the filesystem
        /// </summary>
        /// <param name="id">Guid of the section</param>
        public Section(string id)
        {
            _sectionId = id;
            LoadData();
        }

        /// <summary>
        /// The unique section identifier (guid)
        /// </summary>
        public string SectionId
        {
            get { return _sectionId.ToString(); }
        }

        public abstract List<SearchResult> Search(string searchString, WebPage page);

        /// <summary>
        /// Returns a path to the section's UserControl that is used to display the section in the WebPage
        /// </summary>
        public string UserControl
        {
            get { return string.Format("~/SectionControls/{0}.ascx", GetType().Name); }
        }

        /// <summary>
        /// Path to the data-file.
后面还有 9 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。