aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Web/Tango.MachineService.Gateway/DB/GatewayDbContext.cs
blob: 9f4a9f0f9da289acfad18ccd2e31baef73b8bef7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { col
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Web;
using Tango.Core;

namespace Tango.MachineService.Gateway.DB
{
    public class GatewayDbContext : DbContext
    {
        public GatewayDbContext(DataSource dataSource) : base(dataSource.ToConnection(), true)
        {

        }

        public static GatewayDbContext CreateDefault()
        {
            return new GatewayDbContext(new DataSource()
            {
                Address = GatewayConfig.DB_ADDRESS,
                IntegratedSecurity = false,
                Catalog = GatewayConfig.DB_CATALOG,
                Type = DataSourceType.SQLServer,
                UserName = GatewayConfig.DB_USER_NAME,
                Password = GatewayConfig.DB_PASSWORD
            });
        }

        /// <summary>
        /// Gets or sets the environments.
        /// </summary>
        public DbSet<Environment> Environments
        {
            get; set;
        }
    }
}