diff options
| author | Avi Levkovich <avi@twine-s.com> | 2020-02-17 17:00:29 +0200 |
|---|---|---|
| committer | Avi Levkovich <avi@twine-s.com> | 2020-02-17 17:00:29 +0200 |
| commit | cbc80e71fac7d2896ac496b0fbf22051c0cdcff7 (patch) | |
| tree | 9f898e565748f5581e900491ca36ce21c6462846 /Software/Visual_Studio/Web/Tango.MachineService.Gateway/DB | |
| parent | ef657b4a3ae76e99ab077d6b4fc19691c2a0da4a (diff) | |
| download | Tango-cbc80e71fac7d2896ac496b0fbf22051c0cdcff7.tar.gz Tango-cbc80e71fac7d2896ac496b0fbf22051c0cdcff7.zip | |
merge
Diffstat (limited to 'Software/Visual_Studio/Web/Tango.MachineService.Gateway/DB')
| -rw-r--r-- | Software/Visual_Studio/Web/Tango.MachineService.Gateway/DB/ENVIRONMENT.cs | 24 | ||||
| -rw-r--r-- | Software/Visual_Studio/Web/Tango.MachineService.Gateway/DB/GatewayDbContext.cs | 38 |
2 files changed, 62 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Web/Tango.MachineService.Gateway/DB/ENVIRONMENT.cs b/Software/Visual_Studio/Web/Tango.MachineService.Gateway/DB/ENVIRONMENT.cs new file mode 100644 index 000000000..66cd2ff0c --- /dev/null +++ b/Software/Visual_Studio/Web/Tango.MachineService.Gateway/DB/ENVIRONMENT.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Web; + +namespace Tango.MachineService.Gateway.DB +{ + [Table("ENVIRONMENTS")] + public class Environment + { + [Column("ID")] + public int ID { get; set; } + + [Column("NAME")] + public String Name { get; set; } + + [Column("DESCRIPTION")] + public String Description { get; set; } + + [Column("MACHINE_SERVICE_ADDRESS")] + public String MachineServiceAddress { get; set; } + } +}
\ No newline at end of file diff --git a/Software/Visual_Studio/Web/Tango.MachineService.Gateway/DB/GatewayDbContext.cs b/Software/Visual_Studio/Web/Tango.MachineService.Gateway/DB/GatewayDbContext.cs new file mode 100644 index 000000000..9f4a9f0f9 --- /dev/null +++ b/Software/Visual_Studio/Web/Tango.MachineService.Gateway/DB/GatewayDbContext.cs @@ -0,0 +1,38 @@ +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; + } + } +}
\ No newline at end of file |
