예제 #1
0
 protected override Task <IEnumerable <Blogger> > QueryAsync(string sql, object parameters = null, IDbConnection connection = null)
 {
     if (connection == null)
     {
         using (connection = DBSessionFactory.CreateDbConnection(ConnectionString))
         {
             return(connection.QueryAsync <Blogger, Category, Blogger>(sql, (b, c) => { b.Category = c; return b; }, parameters, splitOn: "Name"));
         }
     }
     else
     {
         return(connection.QueryAsync <Blogger, Category, Blogger>(sql, (b, c) => { b.Category = c; return b; }, parameters, splitOn: "Name"));
     }
 }
예제 #2
0
        public async Task <Blogger> GetDetailAsync(int id)
        {
            string sql = @$ "SELECT TOP 1 b.*, c.Name FROM {TableName} AS b
                        LEFT JOIN Category AS c ON b.CategoryId=c.Id
                        WHERE b.IsDelete=0 AND b.IsShow=1 AND b.Id=@Id";

            using (IDbConnection connection = DBSessionFactory.CreateDbConnection(ConnectionString))
            {
                var result = await connection.QueryAsync <Blogger, Category, Blogger>(sql, (b, c) => { b.Category = c; return(b); }, new
                {
                    Id = id
                }, splitOn : "Name");

                return(result.FirstOrDefault());
            }
        }
예제 #3
0
 public IEnumerable <Reply> GetReplyAllFather(string whereStr)
 {
     return(DBSessionFactory.GetDBSession().ReplyDAL.GetReplyAllFather(whereStr));
 }
예제 #4
0
 public override void SetDAL()
 {
     idal = DBSessionFactory.GetDBSession().SensitiveDAL;
 }
예제 #5
0
 public override void SetDAL()
 {
     idal = DBSessionFactory.GetDBSession().NotificationDAL;
 }
예제 #6
0
 public override void SetDAL()
 {
     idal = DBSessionFactory.GetDBSession().CategoryDAL;
 }
예제 #7
0
 public User Login(string username, string password)
 {
     return(DBSessionFactory.GetDBSession().UserDAL.Login(username, password));
 }
예제 #8
0
 public User GetUserByName(string name)
 {
     return(DBSessionFactory.GetDBSession().UserDAL.GetUserByName(name));
 }
예제 #9
0
 public override void SetDAL()
 {
     idal = DBSessionFactory.GetDBSession().SourceWebDAL;
 }
예제 #10
0
 public override void SetDAL()
 {
     idal = DBSessionFactory.GetDBSession().EXArticleDAL;
 }
예제 #11
0
 /// <summary>
 /// 得到某个日期时间段的更新的博客
 /// </summary>
 /// <param name="begin"></param>
 /// <param name="end"></param>
 /// <returns></returns>
 public int GetUpdateRecordsCountByDate(DateTime begin, DateTime end)
 {
     return(DBSessionFactory.GetDBSession().EXArticleDAL.GetUpdateRecordsCountByDate(begin, end));
 }
예제 #12
0
 /// <summary>
 /// 得到 分类数量
 /// </summary>
 /// <returns></returns>
 public IEnumerable <DapperDict> GetCategoryCount()
 {
     return(DBSessionFactory.GetDBSession().EXArticleTempDAL.GetCategoryCount());
 }
예제 #13
0
 /// <summary>
 /// 得到一段时间内的增加的和修改的数量
 /// </summary>
 /// <param name="begin"></param>
 /// <param name="end"></param>
 /// <returns></returns>
 public IEnumerable <DapperAddAndUpdateRecord> GetAddAndUpdateRecordsByDate(DateTime begin, DateTime end)
 {
     return(DBSessionFactory.GetDBSession().EXArticleTempDAL.GetAddAndUpdateRecordsByDate(begin, end));
 }
예제 #14
0
 public override void SetDAL()
 {
     idal = DBSessionFactory.GetDBSession().TopicforumDAL;
 }
예제 #15
0
 public User GetUserByEmail(string email)
 {
     return(DBSessionFactory.GetDBSession().UserDAL.GetUserByEmail(email));
 }
예제 #16
0
 public override void SetDAL()
 {
     idal = DBSessionFactory.GetDBSession().VideoDAL;
 }
예제 #17
0
 public override void SetDAL()
 {
     idal = DBSessionFactory.GetDBSession().CarouselDAL;
 }