一个接口进一步抽象的实例
定义一个公共接口 IGenericManager
public interface IGenericManager<T> where T:class { /// <summary> /// 信息详细 /// </summary> /// <param name="id"></param> /// <returns></returns> T GetInfo(string id); /// <summary> /// 信息列表 /// </summary> /// <param name="id"></param> /// <returns></returns> List<T> GetList(string id); /// <summary> /// 信息列表 /// </summary> /// <param name="id"></param> /// <param name="Count"></param> /// <returns></returns> List<T> GetList(string id, int Count); /// <summary> /// 信息列表(分页) /// </summary> /// <param name="id"></param> /// <param name="PageSize"></param> /// <param name="PageNumber"></param> /// <param name="Count"></param> /// <returns></returns> List<T> GetList(string id, Int32 PageSize, int PageNumber, out int Count); }
网站新闻接口:
/// <summary> /// 网站新闻 /// </summary> public interface ISchoolNewsManage : IGenericManager<SchoolNewsDAL> { List<SchoolNewsDAL> GetImgList(string Schoolid); }
网站通知接口:
/// <summary> /// 网站通知 /// </summary> public interface ISchoolNoticeManage:IGenericManager<SchoolNoticeDAL> { }
这样就可以把 通知与新闻中的功能抽象。