⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 people.cs

📁 详细介绍中小企业的网站编程,附有详细的注释,对需要制作网站的朋友有很大的帮助,有需要的朋友可下载,
💻 CS
字号:
using System;
using System.Configuration;
using System.Web.Configuration;
using System.Collections;
using System.Collections.Specialized;
using System.Collections.Generic;
using System.Web;
///<summary>
/// class People
/// Provides static functions to access 'people' 
/// and serves as abastraction layer between the web Page and
/// actual data providers
///</summary>
  public static class People {

    private static bool _isInitialized = false;
    private static PeopleProvider _provider;
    private static SmallBusinessDataProvidersSection _providersSection;

    public static PeopleProvider Provider {
      get {
        Initialize();
        return _provider;
      }
    }

    public static List<Person> GetAllPersons()
    {
        return Provider.GetAllPersons();
    }


    private static void Initialize() {
      if (!_isInitialized) {
          _providersSection = (ConfigurationManager.GetSection("SmallBusinessDataProviders")) as SmallBusinessDataProvidersSection;
          if (_providersSection == null)
          {
              throw new Exception(Messages.PeopleConfigSectionNotFound);
        }
        
        _provider = ProvidersHelper.InstantiateProvider(_providersSection.PeopleProviders[_providersSection.PeopleProviderName], 
            typeof(PeopleProvider)) as PeopleProvider; 

        if (_provider == null) {
          throw new Exception("People default provider could not be instantiated");
        }
      }
    }

  }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -