C# partial部分类的使用



public sealed partial class DataAccess
    {
        private static readonly string path = JuSNS.Config.UiConfig.WebDAL;


        public DataAccess()
        { 


        }


    }



public interface INews
{
int DeleteNews(int nid, int uid);
List<NewsChannelInfo> GetNewsChannel(int ParentID, int Type);
int InsertNews(NewsInfo Info);
int InsertUpdateNewsClass(NewsChannelInfo Info);
NewsInfo GetNewsInfo(object nid);
NewsChannelInfo GetNewsChannelInfo(object cid);
int UpdateNewsState(int nid);
int UpdateATT(int NID, int UserID);
NewsCommentInfo GetNewsCommentInfo(int CID);
List<NewsInfo> GetNewsList(int Number, int Flag, int UserID);
int InsertNewsComment(NewsCommentInfo Info);
int DeleteNewsComment(int CID, int UserID);
}


public sealed partial class DataAccess
{
public static INews CreateNews()
{
string className = path + ".App.News";
object objType = JuSNS.Common.DataCache.GetCache(className);
if (objType == null)
{
try
{
objType = Assembly.Load(path).CreateInstance(className);
JuSNS.Common.DataCache.SetCache(className, objType);// 写入缓存
}
catch { }
}
return (INews)objType;
}
}



public class News
    {
        static readonly private News _instance = new News();
        JuSNS.Factory.App.INews dal;
        private News()
        {
            dal = DataAccess.CreateNews();
        }


        /// <summary>
        /// 取得实例
        /// </summary>
        static public News Instance
        {
            get { return _instance; }
        }


        /// <summary>
        /// 删除新闻
        /// </summary>
        /// <param name="nid"></param>
        /// <param name="uid"></param>
        /// <returns></returns>
        public int DeleteNews(int nid, int uid)
        {
            return dal.DeleteNews(nid, uid);
        }

}






  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值