aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/TCC/Tango.TCC.Service/DB/TccDbContext.cs
blob: 5a2e24b31c6f6c7229d22faa191f27b33d47eee9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Tango.BL;
using Tango.Core;
using Tango.TCC.BL.Entities;
using Tango.Web;
using Tango.Web.Helpers;

namespace Tango.TCC.Service.DB
{
    public class TccDbContext
    {
        public static ObservablesContext CreateTango()
        {
            return ObservablesWebContext.CreateContext(TCCServiceConfig.TANGO_DB_CATALOG);
        }

        public static TCCContext CreateTCC()
        {
            //if (System.Diagnostics.Debugger.IsAttached)
            //{
            //    return new TCCContext(new Core.DataSource()
            //    {
            //        Address = "localhost\\SQLEXPRESS",
            //        Catalog = "TCC",
            //        IntegratedSecurity = true,
            //        Type = DataSourceType.SQLServer,
            //    });
            //}
            //else
            //{
                return new TCCContext(new Core.DataSource()
                {
                    Address = WebConfig.DB_ADDRESS,
                    Catalog = WebConfig.DB_CATALOG,
                    IntegratedSecurity = false,
                    Type = DataSourceType.SQLServer,
                    UserName = WebConfig.DB_USER_NAME,
                    Password = WebConfig.DB_PASSWORD
                });
            //}
        }
    }
}