hytos / ID2.Manager / ID2.Manager.Dapper / Repository / ID2Repository.cs @ 90369b9c
이력 | 보기 | 이력해설 | 다운로드 (1.55 KB)
1 |
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 |
public IEnumerable<ID2ProjectInfo> GetID2ProjectList() |
18 |
{ |
19 |
IEnumerable<ID2ProjectInfo> results = null; |
20 |
|
21 |
try |
22 |
{ |
23 |
string query = $@" |
24 |
select pj.Id, pj.Name, pj.Desc, pj.Unit, pj.Path, pj.CreatedDate, pj.UpdatedDate |
25 |
,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 |
|
42 |
results = Query<ID2ProjectInfo>(query); |
43 |
} |
44 |
catch (Exception ex) |
45 |
{ |
46 |
throw ex; |
47 |
//results = new List<ID2ProjectInfo>();//이걸 앞쪽으로 빼기 |
48 |
} |
49 |
|
50 |
return results; |
51 |
} |
52 |
} |
53 |
} |