This commit is contained in:
Lynn Orrell 2021-11-12 03:50:49 -06:00 коммит произвёл GitHub
Родитель 2b1810400d
Коммит 7b12e796ab
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
6 изменённых файлов: 278 добавлений и 13 удалений

4
.gitignore поставляемый
Просмотреть файл

@ -654,4 +654,6 @@ brian-notes.md
contoso-health-notes.md contoso-health-notes.md
# Joey # Joey
components/local/ components/local/
secrets.json

169
RedDog.Bootstrapper/Migrations/20211112094528_ImageUrl.Designer.cs сгенерированный Normal file
Просмотреть файл

@ -0,0 +1,169 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using RedDog.AccountingModel;
namespace RedDog.Bootstrapper.Migrations
{
[DbContext(typeof(AccountingContext))]
[Migration("20211112094528_ImageUrl")]
partial class ImageUrl
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("ProductVersion", "5.0.5")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("RedDog.AccountingModel.Customer", b =>
{
b.Property<string>("LoyaltyId")
.HasColumnType("nvarchar(36)");
b.Property<string>("FirstName")
.IsRequired()
.HasColumnType("nvarchar(50)");
b.Property<string>("LastName")
.IsRequired()
.HasColumnType("nvarchar(50)");
b.HasKey("LoyaltyId");
b.ToTable("Customer");
});
modelBuilder.Entity("RedDog.AccountingModel.Order", b =>
{
b.Property<Guid>("OrderId")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<DateTime?>("CompletedDate")
.HasColumnType("datetime2");
b.Property<string>("CustomerLoyaltyId")
.HasColumnType("nvarchar(36)");
b.Property<decimal>("OrderTotal")
.HasColumnType("decimal(18,2)");
b.Property<DateTime>("PlacedDate")
.HasColumnType("datetime2");
b.Property<string>("StoreId")
.IsRequired()
.HasColumnType("nvarchar(50)");
b.HasKey("OrderId");
b.HasIndex("CustomerLoyaltyId");
b.ToTable("Order");
});
modelBuilder.Entity("RedDog.AccountingModel.OrderItem", b =>
{
b.Property<int>("OrderItemId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("ImageUrl")
.HasColumnType("nvarchar(255)");
b.Property<Guid>("OrderId")
.HasColumnType("uniqueidentifier");
b.Property<int>("ProductId")
.HasColumnType("int");
b.Property<string>("ProductName")
.IsRequired()
.HasColumnType("nvarchar(50)");
b.Property<int>("Quantity")
.HasColumnType("int");
b.Property<decimal>("UnitCost")
.HasColumnType("decimal(18,2)");
b.Property<decimal>("UnitPrice")
.HasColumnType("decimal(18,2)");
b.HasKey("OrderItemId");
b.HasIndex("OrderId");
b.ToTable("OrderItem");
});
modelBuilder.Entity("RedDog.AccountingModel.StoreLocation", b =>
{
b.Property<string>("StoreId")
.HasColumnType("nvarchar(54)");
b.Property<string>("City")
.IsRequired()
.HasColumnType("nvarchar(100)");
b.Property<string>("Country")
.IsRequired()
.HasColumnType("nvarchar(54)");
b.Property<string>("Description")
.HasColumnType("nvarchar(255)");
b.Property<decimal>("Latitude")
.HasColumnType("decimal(12,6)");
b.Property<decimal>("Longitude")
.HasColumnType("decimal(12,6)");
b.Property<string>("PostalCode")
.IsRequired()
.HasColumnType("nvarchar(30)");
b.Property<string>("StateProvince")
.IsRequired()
.HasColumnType("nvarchar(100)");
b.HasKey("StoreId");
b.ToTable("StoreLocation");
});
modelBuilder.Entity("RedDog.AccountingModel.Order", b =>
{
b.HasOne("RedDog.AccountingModel.Customer", "Customer")
.WithMany()
.HasForeignKey("CustomerLoyaltyId");
b.Navigation("Customer");
});
modelBuilder.Entity("RedDog.AccountingModel.OrderItem", b =>
{
b.HasOne("RedDog.AccountingModel.Order", "Order")
.WithMany("OrderItems")
.HasForeignKey("OrderId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Order");
});
modelBuilder.Entity("RedDog.AccountingModel.Order", b =>
{
b.Navigation("OrderItems");
});
#pragma warning restore 612, 618
}
}
}

Просмотреть файл

@ -0,0 +1,44 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace RedDog.Bootstrapper.Migrations
{
public partial class ImageUrl : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "ImageUrl",
table: "OrderItem",
type: "nvarchar(255)",
nullable: true);
migrationBuilder.CreateTable(
name: "StoreLocation",
columns: table => new
{
StoreId = table.Column<string>(type: "nvarchar(54)", nullable: false),
Description = table.Column<string>(type: "nvarchar(255)", nullable: true),
City = table.Column<string>(type: "nvarchar(100)", nullable: false),
StateProvince = table.Column<string>(type: "nvarchar(100)", nullable: false),
PostalCode = table.Column<string>(type: "nvarchar(30)", nullable: false),
Country = table.Column<string>(type: "nvarchar(54)", nullable: false),
Latitude = table.Column<decimal>(type: "decimal(12,6)", nullable: false),
Longitude = table.Column<decimal>(type: "decimal(12,6)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_StoreLocation", x => x.StoreId);
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "StoreLocation");
migrationBuilder.DropColumn(
name: "ImageUrl",
table: "OrderItem");
}
}
}

Просмотреть файл

@ -73,6 +73,9 @@ namespace RedDog.Bootstrapper.Migrations
.HasColumnType("int") .HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("ImageUrl")
.HasColumnType("nvarchar(255)");
b.Property<Guid>("OrderId") b.Property<Guid>("OrderId")
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
@ -99,6 +102,41 @@ namespace RedDog.Bootstrapper.Migrations
b.ToTable("OrderItem"); b.ToTable("OrderItem");
}); });
modelBuilder.Entity("RedDog.AccountingModel.StoreLocation", b =>
{
b.Property<string>("StoreId")
.HasColumnType("nvarchar(54)");
b.Property<string>("City")
.IsRequired()
.HasColumnType("nvarchar(100)");
b.Property<string>("Country")
.IsRequired()
.HasColumnType("nvarchar(54)");
b.Property<string>("Description")
.HasColumnType("nvarchar(255)");
b.Property<decimal>("Latitude")
.HasColumnType("decimal(12,6)");
b.Property<decimal>("Longitude")
.HasColumnType("decimal(12,6)");
b.Property<string>("PostalCode")
.IsRequired()
.HasColumnType("nvarchar(30)");
b.Property<string>("StateProvince")
.IsRequired()
.HasColumnType("nvarchar(100)");
b.HasKey("StoreId");
b.ToTable("StoreLocation");
});
modelBuilder.Entity("RedDog.AccountingModel.Order", b => modelBuilder.Entity("RedDog.AccountingModel.Order", b =>
{ {
b.HasOne("RedDog.AccountingModel.Customer", "Customer") b.HasOne("RedDog.AccountingModel.Customer", "Customer")

Просмотреть файл

@ -114,7 +114,7 @@ namespace RedDog.Bootstrapper
Console.WriteLine(e.StackTrace); Console.WriteLine(e.StackTrace);
Task.Delay(5000).Wait(); Task.Delay(5000).Wait();
} }
} while (connectionString == null); } while (connectionStringSecret == null);
connectionString = connectionStringSecret["reddog-sql"]; connectionString = connectionStringSecret["reddog-sql"];
ShutdownDapr(); ShutdownDapr();
} }

Просмотреть файл

@ -1,19 +1,31 @@
# apiVersion: dapr.io/v1alpha1
# kind: Component
# metadata:
# name: reddog.secretstore
# namespace: reddog-retail
# spec:
# type: secretstores.azure.keyvault
# version: v1
# metadata:
# - name: vaultName
# value: reddog-kv-branch
# - name: spnClientId
# value:
# - name: spnTenantId
# value:
# - name: spnCertificate
# secretKeyRef:
# name: reddog.secretstore
# key: secretstore-cert
apiVersion: dapr.io/v1alpha1 apiVersion: dapr.io/v1alpha1
kind: Component kind: Component
metadata: metadata:
name: reddog.secretstore name: reddog.secretstore
namespace: reddog-retail namespace: reddog-retail
spec: spec:
type: secretstores.azure.keyvault type: secretstores.local.file
version: v1 version: v1
metadata: metadata:
- name: vaultName - name: secretsFile
value: reddog-kv-branch value: ./secrets.json
- name: spnClientId
value:
- name: spnTenantId
value:
- name: spnCertificate
secretKeyRef:
name: reddog.secretstore
key: secretstore-cert