프로젝트

일반

사용자정보

통계
| 브랜치(Branch): | 개정판:

hytos / ID2.Manager / ID2.Manager.Controller / Controllers / BaseController.cs @ fe57f64a

이력 | 보기 | 이력해설 | 다운로드 (1.87 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.Configuration;
8

    
9
using ID2.Manager.Dapper;
10
using ID2.Manager.Data.Models;
11

    
12
namespace ID2.Manager.Controller.Controllers
13
{
14
    public class BaseController
15
    {
16
        public Exception Exception;
17

    
18
        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

    
25
        public BaseController(ID2ProjectInfo id2Info)
26
        {
27
            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
        }
48
    }
49
}
클립보드 이미지 추가 (최대 크기: 500 MB)