프로젝트

일반

사용자정보

통계
| 개정판:

hytos / ID2.Manager / ID2.Manager.Dapper / Repository / ID2Repository.cs @ edded054

이력 | 보기 | 이력해설 | 다운로드 (1.55 KB)

1 be2dacfc yoush97
using System;
2
using System.Collections.Generic;
3
using System.Linq;
4
using System.Text;
5
using System.Threading.Tasks;
6
7
using System.Data.SQLite;
8
9
using ID2.Manager.Data.Models;
10
11
namespace ID2.Manager.Dapper.Repository
12
{
13
    public class ID2Repository : BaseRepository
14
    {
15
        public ID2Repository(string connectionStr, DatabaseType databaseType) : base(connectionStr, databaseType) { }
16
17 81d15568 yoush97
        public IEnumerable<ID2ProjectInfo> GetID2ProjectList()
18 be2dacfc yoush97
        {
19 e8b34346 yoush97
            IEnumerable<ID2ProjectInfo> results = null;
20
21
            try
22
            {
23
                string query = $@"
24 90369b9c yoush97
select    pj.Id, pj.Name, pj.Desc, pj.Unit, pj.Path, pj.CreatedDate, pj.UpdatedDate
25 473ee829 yoush97
         ,ty.UID as DBTypeID ,ty.Name as DBTypeName
26
         ,db.Host, db.User, db.Password, db.FilePath as DBPath
27
from      (
28
              select p.*
29
              from   Projects p
30
                     inner join
31
                     (
32
                         select Min(Id) as Id, Name
33
                         from   Projects
34
                         where  ifnull(Name, '') <> ''
35
                         group by Name
36
                     ) g on p.Id=g.Id
37
          ) pj
38
              inner join DBSettings db on pj.Id=db.Projects_UID
39
              inner join DBTypes ty on db.DBTypes_UID=ty.UID
40
order  by pj.Id;";
41 1abdd7c3 yoush97
42 e8b34346 yoush97
                results = Query<ID2ProjectInfo>(query);
43
            }
44 82705273 yoush97
            catch (Exception ex)
45 e8b34346 yoush97
            {
46 82705273 yoush97
                throw ex;
47
                //results = new List<ID2ProjectInfo>();//이걸 앞쪽으로 빼기
48 e8b34346 yoush97
            }
49
50
            return results;
51 be2dacfc yoush97
        }
52
    }
53
}
클립보드 이미지 추가 (최대 크기: 500 MB)