Browse Source

OrderingDb ConnectionString in Environment Variable and docker-compose.yml file

pull/49/merge
Cesar De la Torre 8 years ago
parent
commit
7f73803441
5 changed files with 11 additions and 7 deletions
  1. +1
    -1
      docker-compose.yml
  2. +3
    -3
      src/Services/Ordering/Ordering.API/Startup.cs
  3. +3
    -2
      src/Services/Ordering/Ordering.API/docker-compose.debug.yml
  4. +1
    -1
      src/Services/Ordering/Ordering.API/docker-compose.yml
  5. +3
    -0
      src/Services/Ordering/Ordering.SqlData/UnitOfWork/OrderingDbContext.cs

+ 1
- 1
docker-compose.yml View File

@ -25,7 +25,7 @@ services:
ordering.api:
image: eshop/ordering.api
environment:
- ConnectionString=TBD
- ConnectionString=Server=10.0.75.1;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word
ports:
- "81:80"
extra_hosts:


+ 3
- 3
src/Services/Ordering/Ordering.API/Startup.cs View File

@ -46,9 +46,9 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API
//var connString = @"Server=CESARDLBOOKVHD;Database=Microsoft.eShopOnContainers.Services.OrderingDb;Trusted_Connection=True;";
//(SQL Server Authentication)
var connString = @"Server=10.0.75.1;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word;";
//(TBD) connString = config.GetConnectionString("SqlStandardAuthentication.OrderingDb");
//var connString = @"Server=10.0.75.1;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word;";
var connString = Configuration["ConnectionString"];
services.AddDbContext<OrderingDbContext>(options => options.UseSqlServer(connString)
.UseSqlServer(connString, b => b.MigrationsAssembly("Ordering.API"))


+ 3
- 2
src/Services/Ordering/Ordering.API/docker-compose.debug.yml View File

@ -2,14 +2,15 @@ version: '2'
services:
microsoft.eshoponcontainers.services.ordering.api:
image: username/microsoft.eshoponcontainers.services.ordering.api:Debug
image: eshop/ordering.api:Debug
build:
context: .
dockerfile: Dockerfile.debug
environment:
- REMOTE_DEBUGGING=${REMOTE_DEBUGGING}
- ConnectionString=Server=10.0.75.1;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word
ports:
- "80:80"
- "81:80"
volumes:
- .:/app
extra_hosts:

+ 1
- 1
src/Services/Ordering/Ordering.API/docker-compose.yml View File

@ -4,7 +4,7 @@ services:
ordering.api:
image: eshop/ordering.api
environment:
- ConnectionString=TBD
- ConnectionString=Server=10.0.75.1;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word
ports:
- "81:80"
extra_hosts:

+ 3
- 0
src/Services/Ordering/Ordering.SqlData/UnitOfWork/OrderingDbContext.cs View File

@ -16,6 +16,8 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.SqlData.UnitOfWork
public DbSet<Order> Orders { get; set; }
//(CDLTLL) Probably delete, not using it for now
/*
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
//If running from ASP.NET Core, config is done at StartUp.cs --> ConfigureServices() outside
@ -39,6 +41,7 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.SqlData.UnitOfWork
}
}
*/
protected override void OnModelCreating(ModelBuilder modelBuilder)
{


Loading…
Cancel
Save