aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Web/Tango.MachineService/Helpers/ObservablesContextHelper.cs
blob: 8f096b0ca5e8c486c6ed944e4cb1bc85c062aaad (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
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
using Tango.BL;
using Tango.Core;

namespace Tango.MachineService.Helpers
{
    public static class ObservablesContextHelper
    {
        public static ObservablesContext CreateContext()
        {
            String address = ConfigurationManager.AppSettings["DbAddress"].ToString();
            String userName = ConfigurationManager.AppSettings["DbUserName"].ToString();
            String password = ConfigurationManager.AppSettings["DbPassword"].ToString();
            String catalog = ConfigurationManager.AppSettings["DbCatalog"].ToString();

            return new ObservablesContext(new DataSource()
            {
                Address = address,
                Catalog = catalog,
                IntegratedSecurity = false,
                Type = DataSourceType.SQLServer,
                UserName = userName,
                Password = password
            });
        }
    }
}