hytos / ID2.Manager / ID2.Manager.Controller / Controllers / BaseController.cs @ fe57f64a
이력 | 보기 | 이력해설 | 다운로드 (1.87 KB)
1 | 8164f84e | 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.Configuration; |
||
8 | |||
9 | fe57f64a | yoush97 | using ID2.Manager.Dapper; |
10 | using ID2.Manager.Data.Models; |
||
11 | |||
12 | 8164f84e | yoush97 | namespace ID2.Manager.Controller.Controllers |
13 | { |
||
14 | public class BaseController |
||
15 | { |
||
16 | c112c3c3 | taeseongkim | public Exception Exception; |
17 | |||
18 | fe57f64a | yoush97 | public readonly string _MSSQLCONNSTR; |
19 | public readonly string _SQLITECONNSTR; |
||
20 | public readonly string _MARKUSCONNSTR; |
||
21 | public readonly string _ID2CONNSTR; |
||
22 | |||
23 | public BaseController() : this(null) { } |
||
24 | 8164f84e | yoush97 | |
25 | fe57f64a | yoush97 | public BaseController(ID2ProjectInfo id2Info) |
26 | 8164f84e | yoush97 | { |
27 | fe57f64a | yoush97 | this._MSSQLCONNSTR = ConfigurationManager.ConnectionStrings["ID2Manager"].ConnectionString; |
28 | this._SQLITECONNSTR = String.Format(ConfigurationManager.AppSettings["ID2SQLite"], System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ConfigurationManager.AppSettings["ID2SQLiteInfo"])); |
||
29 | this._MARKUSCONNSTR = ConfigurationManager.ConnectionStrings["Markus"].ToString(); |
||
30 | |||
31 | if (id2Info != null) |
||
32 | { |
||
33 | DatabaseType DBType = (DatabaseType)Enum.Parse(typeof(DatabaseType), id2Info.DBTypeName.ToUpper()); |
||
34 | switch (DBType) |
||
35 | { |
||
36 | case DatabaseType.MSSQL: |
||
37 | this._ID2CONNSTR = String.Format(ConfigurationManager.ConnectionStrings["ID2Project"].ConnectionString, id2Info.Host, id2Info.DBPath, id2Info.User, id2Info.Password); |
||
38 | break; |
||
39 | case DatabaseType.SQLITE: |
||
40 | this._ID2CONNSTR = String.Format(ConfigurationManager.AppSettings["ID2SQLite"], id2Info.DBPath); |
||
41 | break; |
||
42 | default: |
||
43 | this._ID2CONNSTR = string.Empty; |
||
44 | break; |
||
45 | } |
||
46 | } |
||
47 | 8164f84e | yoush97 | } |
48 | } |
||
49 | } |