Browse Source

Merge branch 'dev' of https://github.com/dotnet-architecture/eShopOnAzure into dev

pull/235/head
Eduard Tomas 7 years ago
parent
commit
bc89bc1ec4
23 changed files with 212 additions and 79 deletions
  1. +6
    -6
      docker-compose.override.yml
  2. +5
    -5
      docker-compose.prod.yml
  3. +1
    -1
      docker-compose.vs.debug.yml
  4. +1
    -1
      docker-compose.vs.release.yml
  5. +1
    -1
      docker-compose.yml
  6. +1
    -1
      src/Services/Basket/Basket.API/Basket.API.csproj
  7. +0
    -2
      src/Services/Basket/Basket.API/BasketSettings.cs
  8. +6
    -18
      src/Services/Basket/Basket.API/Model/RedisBasketRepository.cs
  9. +5
    -7
      src/Services/Basket/Basket.API/Startup.cs
  10. +1
    -2
      src/Services/Basket/Basket.API/appsettings.json
  11. +2
    -2
      src/Services/Catalog/Catalog.API/CatalogSettings.cs
  12. +8
    -5
      src/Services/Catalog/Catalog.API/Controllers/CatalogController.cs
  13. +27
    -7
      src/Services/Catalog/Catalog.API/Controllers/PicController.cs
  14. +3
    -1
      src/Services/Catalog/Catalog.API/Infrastructure/CatalogContext.cs
  15. +12
    -12
      src/Services/Catalog/Catalog.API/Infrastructure/CatalogContextSeed.cs
  16. +99
    -0
      src/Services/Catalog/Catalog.API/Infrastructure/CatalogMigrations/20170530133114_AddPictureFileName.Designer.cs
  17. +25
    -0
      src/Services/Catalog/Catalog.API/Infrastructure/CatalogMigrations/20170530133114_AddPictureFileName.cs
  18. +1
    -1
      src/Services/Catalog/Catalog.API/Infrastructure/CatalogMigrations/CatalogContextModelSnapshot.cs
  19. +2
    -0
      src/Services/Catalog/Catalog.API/Model/CatalogItem.cs
  20. +1
    -1
      src/Services/Catalog/Catalog.API/Startup.cs
  21. +3
    -3
      src/Services/Catalog/Catalog.API/settings.json
  22. +1
    -1
      src/Services/Ordering/Ordering.API/Startup.cs
  23. +1
    -2
      src/Services/Ordering/Ordering.API/settings.json

+ 6
- 6
docker-compose.override.yml View File

@ -1,4 +1,4 @@
version: '2'
version: '2.1'
# The default docker-compose.override file can use the "localhost" as the external name for testing web apps within the same dev machine. # The default docker-compose.override file can use the "localhost" as the external name for testing web apps within the same dev machine.
# The ESHOP_EXTERNAL_DNS_NAME_OR_IP environment variable is taken, by default, from the ".env" file defined like: # The ESHOP_EXTERNAL_DNS_NAME_OR_IP environment variable is taken, by default, from the ".env" file defined like:
@ -12,9 +12,9 @@ services:
environment: environment:
- ASPNETCORE_ENVIRONMENT=Development - ASPNETCORE_ENVIRONMENT=Development
- ASPNETCORE_URLS=http://0.0.0.0:80 - ASPNETCORE_URLS=http://0.0.0.0:80
- ConnectionString=basket.data
- ConnectionString=${ESHOP_AZURE_REDIS:-basket.data}
- identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105. - identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105.
- EventBusConnection=rabbitmq
- EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq}
ports: ports:
- "5103:80" - "5103:80"
@ -23,8 +23,8 @@ services:
- ASPNETCORE_ENVIRONMENT=Development - ASPNETCORE_ENVIRONMENT=Development
- ASPNETCORE_URLS=http://0.0.0.0:80 - ASPNETCORE_URLS=http://0.0.0.0:80
- ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word - ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word
- ExternalCatalogBaseUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5101 #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105.
- EventBusConnection=rabbitmq
- PicBaseUrl=${ESHOP_AZURE_STORAGE_ACCOUNT:-http://localhost:5101/api/v1/pic/} #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105.
- EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq}
ports: ports:
- "5101:80" - "5101:80"
@ -45,7 +45,7 @@ services:
- ASPNETCORE_URLS=http://0.0.0.0:80 - ASPNETCORE_URLS=http://0.0.0.0:80
- ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word - ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word
- identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105. - identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105.
- EventBusConnection=rabbitmq
- EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq}
ports: ports:
- "5102:80" - "5102:80"


+ 5
- 5
docker-compose.prod.yml View File

@ -1,4 +1,4 @@
version: '2'
version: '2.1'
# The Production docker-compose file has to have the external/real IPs or DNS names for the services # The Production docker-compose file has to have the external/real IPs or DNS names for the services
# The ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP environment variable is taken, by default, from the ".env" file defined like: # The ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP environment variable is taken, by default, from the ".env" file defined like:
@ -17,9 +17,9 @@ services:
environment: environment:
- ASPNETCORE_ENVIRONMENT=Production - ASPNETCORE_ENVIRONMENT=Production
- ASPNETCORE_URLS=http://0.0.0.0:80 - ASPNETCORE_URLS=http://0.0.0.0:80
- ConnectionString=basket.data
- ConnectionString=${ESHOP_AZURE_REDIS:-basket.data}
- identityUrl=http://identity.api #Local: You need to open your host's firewall at range 5100-5105. at range 5100-5105. - identityUrl=http://identity.api #Local: You need to open your host's firewall at range 5100-5105. at range 5100-5105.
- EventBusConnection=rabbitmq
- EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq}
ports: ports:
- "5103:80" - "5103:80"
@ -29,7 +29,7 @@ services:
- ASPNETCORE_URLS=http://0.0.0.0:80 - ASPNETCORE_URLS=http://0.0.0.0:80
- ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word - ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word
- ExternalCatalogBaseUrl=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5101 #Local: You need to open your host's firewall at range 5100-5105. at range 5100-5105. - ExternalCatalogBaseUrl=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5101 #Local: You need to open your host's firewall at range 5100-5105. at range 5100-5105.
- EventBusConnection=rabbitmq
- EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq}
ports: ports:
- "5101:80" - "5101:80"
@ -50,7 +50,7 @@ services:
- ASPNETCORE_URLS=http://0.0.0.0:80 - ASPNETCORE_URLS=http://0.0.0.0:80
- ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word - ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word
- identityUrl=http://identity.api #Local: You need to open your host's firewall at range 5100-5105. at range 5100-5105. - identityUrl=http://identity.api #Local: You need to open your host's firewall at range 5100-5105. at range 5100-5105.
- EventBusConnection=rabbitmq
- EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq}
ports: ports:
- "5102:80" - "5102:80"


+ 1
- 1
docker-compose.vs.debug.yml View File

@ -1,4 +1,4 @@
version: '2'
version: '2.1'
services: services:
basket.api: basket.api:


+ 1
- 1
docker-compose.vs.release.yml View File

@ -1,4 +1,4 @@
version: '2'
version: '2.1'
services: services:
basket.api: basket.api:


+ 1
- 1
docker-compose.yml View File

@ -1,4 +1,4 @@
version: '2'
version: '2.1'
services: services:
basket.api: basket.api:


+ 1
- 1
src/Services/Basket/Basket.API/Basket.API.csproj View File

@ -22,6 +22,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="StackExchange.Redis" Version="1.2.3" />
<PackageReference Include="System.Threading" Version="4.3.0" /> <PackageReference Include="System.Threading" Version="4.3.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.2" /> <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.2" />
<PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="1.1.1" /> <PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="1.1.1" />
@ -33,7 +34,6 @@
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.1" /> <PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.1" /> <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="1.1.1" /> <PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="1.1.1" />
<PackageReference Include="StackExchange.Redis" Version="1.1.608" />
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" /> <PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
<PackageReference Include="IdentityServer4.AccessTokenValidation" Version="1.0.1-rc3" /> <PackageReference Include="IdentityServer4.AccessTokenValidation" Version="1.0.1-rc3" />
<PackageReference Include="Swashbuckle" Version="6.0.0-beta902" /> <PackageReference Include="Swashbuckle" Version="6.0.0-beta902" />


+ 0
- 2
src/Services/Basket/Basket.API/BasketSettings.cs View File

@ -5,7 +5,5 @@
public string ConnectionString { get; set; } public string ConnectionString { get; set; }
public string EventBusConnection { get; set; } public string EventBusConnection { get; set; }
public string ServiceBusConnectionString { get; set; }
} }
} }

+ 6
- 18
src/Services/Basket/Basket.API/Model/RedisBasketRepository.cs View File

@ -4,7 +4,6 @@ using Newtonsoft.Json;
using StackExchange.Redis; using StackExchange.Redis;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Net;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Services.Basket.API.Model namespace Microsoft.eShopOnContainers.Services.Basket.API.Model
@ -16,12 +15,10 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API.Model
private ConnectionMultiplexer _redis; private ConnectionMultiplexer _redis;
public RedisBasketRepository(IOptionsSnapshot<BasketSettings> options, ILoggerFactory loggerFactory) public RedisBasketRepository(IOptionsSnapshot<BasketSettings> options, ILoggerFactory loggerFactory)
{ {
_settings = options.Value; _settings = options.Value;
_logger = loggerFactory.CreateLogger<RedisBasketRepository>(); _logger = loggerFactory.CreateLogger<RedisBasketRepository>();
} }
public async Task<bool> DeleteBasketAsync(string id) public async Task<bool> DeleteBasketAsync(string id)
@ -93,21 +90,12 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API.Model
} }
private async Task ConnectToRedisAsync() private async Task ConnectToRedisAsync()
{
// TODO: Need to make this more robust. ConnectionMultiplexer.ConnectAsync doesn't like domain names or IPv6 addresses.
if (IPAddress.TryParse(_settings.ConnectionString, out var ip))
{
_redis = await ConnectionMultiplexer.ConnectAsync(ip.ToString());
_logger.LogInformation($"Connecting to database at {_settings.ConnectionString}");
}
else
{
// workaround for https://github.com/StackExchange/StackExchange.Redis/issues/410
var ips = await Dns.GetHostAddressesAsync(_settings.ConnectionString);
_logger.LogInformation($"Connecting to database {_settings.ConnectionString} at IP {ips.First().ToString()}");
_redis = await ConnectionMultiplexer.ConnectAsync(ips.First().ToString());
}
{
var configuration = ConfigurationOptions.Parse(_settings.ConnectionString, true);
configuration.ResolveDns = true;
_logger.LogInformation($"Connecting to database {configuration.SslHost}.");
_redis = await ConnectionMultiplexer.ConnectAsync(configuration);
} }
} }
} }

+ 5
- 7
src/Services/Basket/Basket.API/Startup.cs View File

@ -16,11 +16,8 @@ using Microsoft.Extensions.HealthChecks;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using RabbitMQ.Client; using RabbitMQ.Client;
using StackExchange.Redis;
using System.Linq;
using System.Net;
using System.Threading.Tasks; using System.Threading.Tasks;
using System;
using StackExchange.Redis;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus; using Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus;
using Microsoft.Azure.ServiceBus; using Microsoft.Azure.ServiceBus;
@ -66,9 +63,10 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
services.AddSingleton<ConnectionMultiplexer>(sp => services.AddSingleton<ConnectionMultiplexer>(sp =>
{ {
var settings = sp.GetRequiredService<IOptions<BasketSettings>>().Value; var settings = sp.GetRequiredService<IOptions<BasketSettings>>().Value;
var ips = Dns.GetHostAddressesAsync(settings.ConnectionString).Result;
ConfigurationOptions configuration = ConfigurationOptions.Parse(settings.ConnectionString, true);
configuration.ResolveDns = true;
return ConnectionMultiplexer.Connect(ips.First().ToString());
return ConnectionMultiplexer.Connect(configuration);
}); });
@ -79,7 +77,7 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
var settings = sp.GetRequiredService<IOptions<BasketSettings>>().Value; var settings = sp.GetRequiredService<IOptions<BasketSettings>>().Value;
var logger = sp.GetRequiredService<ILogger<DefaultServiceBusPersisterConnection>>(); var logger = sp.GetRequiredService<ILogger<DefaultServiceBusPersisterConnection>>();
var serviceBusConnection = new ServiceBusConnectionStringBuilder(settings.ServiceBusConnectionString);
var serviceBusConnection = new ServiceBusConnectionStringBuilder(settings.EventBusConnection);
return new DefaultServiceBusPersisterConnection(serviceBusConnection, logger); return new DefaultServiceBusPersisterConnection(serviceBusConnection, logger);
}); });


+ 1
- 2
src/Services/Basket/Basket.API/appsettings.json View File

@ -9,7 +9,6 @@
}, },
"IdentityUrl": "http://localhost:5105", "IdentityUrl": "http://localhost:5105",
"ConnectionString": "127.0.0.1", "ConnectionString": "127.0.0.1",
"ServiceBusConnectionString": "Endpoint=sb://eshopsbez55a72p6wm62.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=oA6WpfCfCbScZbQa/DBOLfwl6oi5ezPsCYL7QsTb4PY=;EntityPath=eshop_event_bus",
"AzureServiceBusEnabled": "true",
"AzureServiceBusEnabled": false,
"SubscriptionClientName": "Basket" "SubscriptionClientName": "Basket"
} }

+ 2
- 2
src/Services/Catalog/Catalog.API/CatalogSettings.cs View File

@ -2,10 +2,10 @@
{ {
public class CatalogSettings public class CatalogSettings
{ {
public string ExternalCatalogBaseUrl {get;set;}
public string PicBaseUrl { get;set;}
public string EventBusConnection { get; set; } public string EventBusConnection { get; set; }
public string ServiceBusConnectionString { get; set; }
public bool AzureStorageEnabled { get; set; }
} }
} }

+ 8
- 5
src/Services/Catalog/Catalog.API/Controllers/CatalogController.cs View File

@ -200,7 +200,7 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers
CatalogTypeId = product.CatalogTypeId, CatalogTypeId = product.CatalogTypeId,
Description = product.Description, Description = product.Description,
Name = product.Name, Name = product.Name,
PictureUri = product.PictureUri,
PictureFileName = product.PictureFileName,
Price = product.Price Price = product.Price
}; };
_catalogContext.CatalogItems.Add(item); _catalogContext.CatalogItems.Add(item);
@ -231,11 +231,14 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers
private List<CatalogItem> ChangeUriPlaceholder(List<CatalogItem> items) private List<CatalogItem> ChangeUriPlaceholder(List<CatalogItem> items)
{ {
var baseUri = _settings.ExternalCatalogBaseUrl;
items.ForEach(x =>
var baseUri = _settings.PicBaseUrl;
items.ForEach(catalogItem =>
{ {
x.PictureUri = x.PictureUri.Replace("http://externalcatalogbaseurltobereplaced", baseUri);
catalogItem.PictureUri = _settings.AzureStorageEnabled
? baseUri + catalogItem.PictureFileName
: baseUri + catalogItem.Id;
}); });
return items; return items;


+ 27
- 7
src/Services/Catalog/Catalog.API/Controllers/PicController.cs View File

@ -1,6 +1,9 @@
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure;
using System.IO; using System.IO;
using System.Threading.Tasks;
// For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860 // For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860
@ -10,21 +13,38 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers
public class PicController : Controller public class PicController : Controller
{ {
private readonly IHostingEnvironment _env; private readonly IHostingEnvironment _env;
public PicController(IHostingEnvironment env)
private readonly CatalogContext _catalogContext;
public PicController(IHostingEnvironment env,
CatalogContext catalogContext)
{ {
_env = env; _env = env;
_catalogContext = catalogContext;
} }
[HttpGet("{id}")] [HttpGet("{id}")]
// GET: /<controller>/ // GET: /<controller>/
public IActionResult GetImage(int id)
public async Task<IActionResult> GetImage(int id)
{ {
var webRoot = _env.WebRootPath;
var path = Path.Combine(webRoot, id + ".png");
if (id <= 0)
{
return BadRequest();
}
var item = await _catalogContext.CatalogItems
.SingleOrDefaultAsync(ci => ci.Id == id);
if (item != null)
{
var webRoot = _env.WebRootPath;
var path = Path.Combine(webRoot, item.PictureFileName);
var buffer = System.IO.File.ReadAllBytes(path);
return File(buffer, "image/png");
}
var buffer = System.IO.File.ReadAllBytes(path);
return File(buffer, "image/png");
return NotFound();
} }
} }
} }

+ 3
- 1
src/Services/Catalog/Catalog.API/Infrastructure/CatalogContext.cs View File

@ -36,9 +36,11 @@
builder.Property(ci => ci.Price) builder.Property(ci => ci.Price)
.IsRequired(true); .IsRequired(true);
builder.Property(ci => ci.PictureUri)
builder.Property(ci => ci.PictureFileName)
.IsRequired(false); .IsRequired(false);
builder.Ignore(ci => ci.PictureUri);
builder.HasOne(ci => ci.CatalogBrand) builder.HasOne(ci => ci.CatalogBrand)
.WithMany() .WithMany()
.HasForeignKey(ci => ci.CatalogBrandId); .HasForeignKey(ci => ci.CatalogBrandId);


+ 12
- 12
src/Services/Catalog/Catalog.API/Infrastructure/CatalogContextSeed.cs View File

@ -70,18 +70,18 @@
{ {
return new List<CatalogItem>() return new List<CatalogItem>()
{ {
new CatalogItem() { CatalogTypeId=2,CatalogBrandId=2, Description = ".NET Bot Black Hoodie", Name = ".NET Bot Black Hoodie", Price = 19.5M, PictureUri = "http://externalcatalogbaseurltobereplaced/api/v1/pic/1" },
new CatalogItem() { CatalogTypeId=1,CatalogBrandId=2, Description = ".NET Black & White Mug", Name = ".NET Black & White Mug", Price= 8.50M, PictureUri = "http://externalcatalogbaseurltobereplaced/api/v1/pic/2" },
new CatalogItem() { CatalogTypeId=2,CatalogBrandId=5, Description = "Prism White T-Shirt", Name = "Prism White T-Shirt", Price = 12, PictureUri = "http://externalcatalogbaseurltobereplaced/api/v1/pic/3" },
new CatalogItem() { CatalogTypeId=2,CatalogBrandId=2, Description = ".NET Foundation T-shirt", Name = ".NET Foundation T-shirt", Price = 12, PictureUri = "http://externalcatalogbaseurltobereplaced/api/v1/pic/4" },
new CatalogItem() { CatalogTypeId=3,CatalogBrandId=5, Description = "Roslyn Red Sheet", Name = "Roslyn Red Sheet", Price = 8.5M, PictureUri = "http://externalcatalogbaseurltobereplaced/api/v1/pic/5" },
new CatalogItem() { CatalogTypeId=2,CatalogBrandId=2, Description = ".NET Blue Hoodie", Name = ".NET Blue Hoodie", Price = 12, PictureUri = "http://externalcatalogbaseurltobereplaced/api/v1/pic/6" },
new CatalogItem() { CatalogTypeId=2,CatalogBrandId=5, Description = "Roslyn Red T-Shirt", Name = "Roslyn Red T-Shirt", Price = 12, PictureUri = "http://externalcatalogbaseurltobereplaced/api/v1/pic/7" },
new CatalogItem() { CatalogTypeId=2,CatalogBrandId=5, Description = "Kudu Purple Hoodie", Name = "Kudu Purple Hoodie", Price = 8.5M, PictureUri = "http://externalcatalogbaseurltobereplaced/api/v1/pic/8" },
new CatalogItem() { CatalogTypeId=1,CatalogBrandId=5, Description = "Cup<T> White Mug", Name = "Cup<T> White Mug", Price = 12, PictureUri = "http://externalcatalogbaseurltobereplaced/api/v1/pic/9" },
new CatalogItem() { CatalogTypeId=3,CatalogBrandId=2, Description = ".NET Foundation Sheet", Name = ".NET Foundation Sheet", Price = 12, PictureUri = "http://externalcatalogbaseurltobereplaced/api/v1/pic/10" },
new CatalogItem() { CatalogTypeId=3,CatalogBrandId=2, Description = "Cup<T> Sheet", Name = "Cup<T> Sheet", Price = 8.5M, PictureUri = "http://externalcatalogbaseurltobereplaced/api/v1/pic/11" },
new CatalogItem() { CatalogTypeId=2,CatalogBrandId=5, Description = "Prism White TShirt", Name = "Prism White TShirt", Price = 12, PictureUri = "http://externalcatalogbaseurltobereplaced/api/v1/pic/12" }
new CatalogItem() { CatalogTypeId=2,CatalogBrandId=2, Description = ".NET Bot Black Hoodie", Name = ".NET Bot Black Hoodie", Price = 19.5M, PictureFileName = "1.png" },
new CatalogItem() { CatalogTypeId=1,CatalogBrandId=2, Description = ".NET Black & White Mug", Name = ".NET Black & White Mug", Price= 8.50M, PictureFileName = "2.png" },
new CatalogItem() { CatalogTypeId=2,CatalogBrandId=5, Description = "Prism White T-Shirt", Name = "Prism White T-Shirt", Price = 12, PictureFileName = "3.png" },
new CatalogItem() { CatalogTypeId=2,CatalogBrandId=2, Description = ".NET Foundation T-shirt", Name = ".NET Foundation T-shirt", Price = 12, PictureFileName = "4.png" },
new CatalogItem() { CatalogTypeId=3,CatalogBrandId=5, Description = "Roslyn Red Sheet", Name = "Roslyn Red Sheet", Price = 8.5M, PictureFileName = "5.png" },
new CatalogItem() { CatalogTypeId=2,CatalogBrandId=2, Description = ".NET Blue Hoodie", Name = ".NET Blue Hoodie", Price = 12, PictureFileName = "6.png" },
new CatalogItem() { CatalogTypeId=2,CatalogBrandId=5, Description = "Roslyn Red T-Shirt", Name = "Roslyn Red T-Shirt", Price = 12, PictureFileName = "7.png" },
new CatalogItem() { CatalogTypeId=2,CatalogBrandId=5, Description = "Kudu Purple Hoodie", Name = "Kudu Purple Hoodie", Price = 8.5M, PictureFileName = "8.png" },
new CatalogItem() { CatalogTypeId=1,CatalogBrandId=5, Description = "Cup<T> White Mug", Name = "Cup<T> White Mug", Price = 12, PictureFileName = "9.png" },
new CatalogItem() { CatalogTypeId=3,CatalogBrandId=2, Description = ".NET Foundation Sheet", Name = ".NET Foundation Sheet", Price = 12, PictureFileName = "10.png" },
new CatalogItem() { CatalogTypeId=3,CatalogBrandId=2, Description = "Cup<T> Sheet", Name = "Cup<T> Sheet", Price = 8.5M, PictureFileName = "11.png" },
new CatalogItem() { CatalogTypeId=2,CatalogBrandId=5, Description = "Prism White TShirt", Name = "Prism White TShirt", Price = 12, PictureFileName = "12.png" },
}; };
} }
} }


+ 99
- 0
src/Services/Catalog/Catalog.API/Infrastructure/CatalogMigrations/20170530133114_AddPictureFileName.Designer.cs View File

@ -0,0 +1,99 @@
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure;
namespace Catalog.API.Infrastructure.Migrations
{
[DbContext(typeof(CatalogContext))]
[Migration("20170530133114_AddPictureFile")]
partial class AddPictureFile
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
modelBuilder
.HasAnnotation("ProductVersion", "1.1.1")
.HasAnnotation("SqlServer:Sequence:.catalog_brand_hilo", "'catalog_brand_hilo', '', '1', '10', '', '', 'Int64', 'False'")
.HasAnnotation("SqlServer:Sequence:.catalog_hilo", "'catalog_hilo', '', '1', '10', '', '', 'Int64', 'False'")
.HasAnnotation("SqlServer:Sequence:.catalog_type_hilo", "'catalog_type_hilo', '', '1', '10', '', '', 'Int64', 'False'")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Catalog.API.Model.CatalogBrand", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:HiLoSequenceName", "catalog_brand_hilo")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo);
b.Property<string>("Brand")
.IsRequired()
.HasMaxLength(100);
b.HasKey("Id");
b.ToTable("CatalogBrand");
});
modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Catalog.API.Model.CatalogItem", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:HiLoSequenceName", "catalog_hilo")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo);
b.Property<int>("CatalogBrandId");
b.Property<int>("CatalogTypeId");
b.Property<string>("Description");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50);
b.Property<string>("PictureFileName");
b.Property<decimal>("Price");
b.HasKey("Id");
b.HasIndex("CatalogBrandId");
b.HasIndex("CatalogTypeId");
b.ToTable("Catalog");
});
modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Catalog.API.Model.CatalogType", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:HiLoSequenceName", "catalog_type_hilo")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo);
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(100);
b.HasKey("Id");
b.ToTable("CatalogType");
});
modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Catalog.API.Model.CatalogItem", b =>
{
b.HasOne("Microsoft.eShopOnContainers.Services.Catalog.API.Model.CatalogBrand", "CatalogBrand")
.WithMany()
.HasForeignKey("CatalogBrandId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Microsoft.eShopOnContainers.Services.Catalog.API.Model.CatalogType", "CatalogType")
.WithMany()
.HasForeignKey("CatalogTypeId")
.OnDelete(DeleteBehavior.Cascade);
});
}
}
}

+ 25
- 0
src/Services/Catalog/Catalog.API/Infrastructure/CatalogMigrations/20170530133114_AddPictureFileName.cs View File

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Catalog.API.Infrastructure.Migrations
{
public partial class AddPictureFile : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "PictureUri",
table: "Catalog",
newName: "PictureFileName");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "PictureFileName",
table: "Catalog",
newName: "PictureUri");
}
}
}

+ 1
- 1
src/Services/Catalog/Catalog.API/Infrastructure/CatalogMigrations/CatalogContextModelSnapshot.cs View File

@ -52,7 +52,7 @@ namespace Catalog.API.Infrastructure.Migrations
.IsRequired() .IsRequired()
.HasMaxLength(50); .HasMaxLength(50);
b.Property<string>("PictureUri");
b.Property<string>("PictureFileName");
b.Property<decimal>("Price"); b.Property<decimal>("Price");


+ 2
- 0
src/Services/Catalog/Catalog.API/Model/CatalogItem.cs View File

@ -12,6 +12,8 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API.Model
public decimal Price { get; set; } public decimal Price { get; set; }
public string PictureFileName { get; set; }
public string PictureUri { get; set; } public string PictureUri { get; set; }
public int CatalogTypeId { get; set; } public int CatalogTypeId { get; set; }


+ 1
- 1
src/Services/Catalog/Catalog.API/Startup.cs View File

@ -118,7 +118,7 @@
var settings = sp.GetRequiredService<IOptions<CatalogSettings>>().Value; var settings = sp.GetRequiredService<IOptions<CatalogSettings>>().Value;
var logger = sp.GetRequiredService<ILogger<DefaultServiceBusPersisterConnection>>(); var logger = sp.GetRequiredService<ILogger<DefaultServiceBusPersisterConnection>>();
var serviceBusConnection = new ServiceBusConnectionStringBuilder(settings.ServiceBusConnectionString);
var serviceBusConnection = new ServiceBusConnectionStringBuilder(settings.EventBusConnection);
return new DefaultServiceBusPersisterConnection(serviceBusConnection, logger); return new DefaultServiceBusPersisterConnection(serviceBusConnection, logger);
}); });


+ 3
- 3
src/Services/Catalog/Catalog.API/settings.json View File

@ -1,6 +1,6 @@
{ {
"ConnectionString": "Server=tcp:127.0.0.1,5433;Initial Catalog=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word", "ConnectionString": "Server=tcp:127.0.0.1,5433;Initial Catalog=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word",
"ExternalCatalogBaseUrl": "http://localhost:5101",
"PicBaseUrl": "http://localhost:5101",
"Logging": { "Logging": {
"IncludeScopes": false, "IncludeScopes": false,
"LogLevel": { "LogLevel": {
@ -9,7 +9,7 @@
"Microsoft": "Information" "Microsoft": "Information"
} }
}, },
"ServiceBusConnectionString": "Endpoint=sb://eshopsbez55a72p6wm62.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=oA6WpfCfCbScZbQa/DBOLfwl6oi5ezPsCYL7QsTb4PY=;EntityPath=eshop_event_bus",
"AzureServiceBusEnabled": "true",
"AzureServiceBusEnabled": false,
"AzureStorageEnabled": false,
"SubscriptionClientName": "Catalog" "SubscriptionClientName": "Catalog"
} }

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

@ -121,7 +121,7 @@
{ {
var logger = sp.GetRequiredService<ILogger<DefaultServiceBusPersisterConnection>>(); var logger = sp.GetRequiredService<ILogger<DefaultServiceBusPersisterConnection>>();
var serviceBusConnectionString = Configuration["ServiceBusConnectionString"];
var serviceBusConnectionString = Configuration["EventBusConnection"];
var serviceBusConnection = new ServiceBusConnectionStringBuilder(serviceBusConnectionString); var serviceBusConnection = new ServiceBusConnectionStringBuilder(serviceBusConnectionString);
return new DefaultServiceBusPersisterConnection(serviceBusConnection, logger); return new DefaultServiceBusPersisterConnection(serviceBusConnection, logger);


+ 1
- 2
src/Services/Ordering/Ordering.API/settings.json View File

@ -9,7 +9,6 @@
"Microsoft": "Information" "Microsoft": "Information"
} }
}, },
"ServiceBusConnectionString": "Endpoint=sb://eshopsbez55a72p6wm62.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=oA6WpfCfCbScZbQa/DBOLfwl6oi5ezPsCYL7QsTb4PY=;EntityPath=eshop_event_bus",
"AzureServiceBusEnabled": "true",
"AzureServiceBusEnabled": false,
"SubscriptionClientName": "Ordering" "SubscriptionClientName": "Ordering"
} }

Loading…
Cancel
Save