Browse Source

Fixed #1518 bug (#1520)

* Update CatalogContextModelSnapshot.cs

* Update CatalogContextSeed.cs

* Modify CSV data

* Give PictureFileName assignment
pull/1525/head
ansonzhang 4 years ago
committed by GitHub
parent
commit
7e59cd1ffc
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 7 deletions
  1. +2
    -2
      src/Services/Catalog/Catalog.API/Infrastructure/CatalogContextSeed.cs
  2. +5
    -4
      src/Services/Catalog/Catalog.API/Infrastructure/CatalogMigrations/CatalogContextModelSnapshot.cs
  3. +1
    -1
      src/Services/Catalog/Catalog.API/Setup/CatalogItems.csv

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

@ -181,7 +181,7 @@
string[] csvheaders; string[] csvheaders;
try try
{ {
string[] requiredHeaders = { "catalogtypename", "catalogbrandname", "description", "name", "price", "pictureFileName" };
string[] requiredHeaders = { "catalogtypename", "catalogbrandname", "description", "name", "price", "picturefilename" };
string[] optionalheaders = { "availablestock", "restockthreshold", "maxstockthreshold", "onreorder" }; string[] optionalheaders = { "availablestock", "restockthreshold", "maxstockthreshold", "onreorder" };
csvheaders = GetHeaders(csvFileCatalogItems, requiredHeaders, optionalheaders ); csvheaders = GetHeaders(csvFileCatalogItems, requiredHeaders, optionalheaders );
} }
@ -234,7 +234,7 @@
Description = column[Array.IndexOf(headers, "description")].Trim('"').Trim(), Description = column[Array.IndexOf(headers, "description")].Trim('"').Trim(),
Name = column[Array.IndexOf(headers, "name")].Trim('"').Trim(), Name = column[Array.IndexOf(headers, "name")].Trim('"').Trim(),
Price = price, Price = price,
PictureUri = column[Array.IndexOf(headers, "pictureuri")].Trim('"').Trim(),
PictureFileName = column[Array.IndexOf(headers, "picturefilename")].Trim('"').Trim(),
}; };
int availableStockIndex = Array.IndexOf(headers, "availablestock"); int availableStockIndex = Array.IndexOf(headers, "availablestock");


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

@ -14,9 +14,10 @@ namespace Catalog.API.Infrastructure.Migrations
{ {
modelBuilder modelBuilder
.HasAnnotation("ProductVersion", "1.1.1") .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("Relational:MaxIdentifierLength", 128)
.HasAnnotation("Relational:Sequence:.catalog_brand_hilo", "'catalog_brand_hilo', '', '1', '10', '', '', 'Int64', 'False'")
.HasAnnotation("Relational:Sequence:.catalog_hilo", "'catalog_hilo', '', '1', '10', '', '', 'Int64', 'False'")
.HasAnnotation("Relational:Sequence:.catalog_type_hilo", "'catalog_type_hilo', '', '1', '10', '', '', 'Int64', 'False'")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Catalog.API.Model.CatalogBrand", b => modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Catalog.API.Model.CatalogBrand", b =>
@ -58,7 +59,7 @@ namespace Catalog.API.Infrastructure.Migrations
b.Property<bool>("OnReorder"); b.Property<bool>("OnReorder");
b.Property<string>("PictureUri");
b.Property<string>("PictureFileName");
b.Property<decimal>("Price"); b.Property<decimal>("Price");


+ 1
- 1
src/Services/Catalog/Catalog.API/Setup/CatalogItems.csv View File

@ -5,7 +5,7 @@ T-Shirt,Other,Prism White T-Shirt,Prism White T-Shirt,12,3.png,56,false
T-Shirt,.NET,.NET Foundation T-shirt,.NET Foundation T-shirt,12,4.png,120,false T-Shirt,.NET,.NET Foundation T-shirt,.NET Foundation T-shirt,12,4.png,120,false
Sheet,Other,Roslyn Red Sheet,Roslyn Red Sheet,8.5,5.png,55,false Sheet,Other,Roslyn Red Sheet,Roslyn Red Sheet,8.5,5.png,55,false
T-Shirt,.NET,.NET Blue Hoodie,.NET Blue Hoodie,12,6.png,17,false T-Shirt,.NET,.NET Blue Hoodie,.NET Blue Hoodie,12,6.png,17,false
T-Shirt,Other,Roslyn Red T-Shirt,Roslyn Red T-Shirt",12,7.png,8,false
T-Shirt,Other,Roslyn Red T-Shirt,Roslyn Red T-Shirt,12,7.png,8,false
T-Shirt,Other,Kudu Purple Hoodie,Kudu Purple Hoodie,8.5,8.png,34,false T-Shirt,Other,Kudu Purple Hoodie,Kudu Purple Hoodie,8.5,8.png,34,false
Mug,Other,Cup<T> White Mug,Cup<T> White Mug,12,9.png,76,false Mug,Other,Cup<T> White Mug,Cup<T> White Mug,12,9.png,76,false
Sheet,.NET,.NET Foundation Sheet,.NET Foundation Sheet,12,10.png,11,false Sheet,.NET,.NET Foundation Sheet,.NET Foundation Sheet,12,10.png,11,false


Loading…
Cancel
Save