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);
}
}