zeroframework/Services/DeviceCenter/ZeroFramework.DeviceCenter.Infrastructure/Migrations/DeviceCenterDbContextModelSnapshot.cs
2023-12-05 17:22:48 +08:00

736 lines
28 KiB
C#

// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using ZeroFramework.DeviceCenter.Infrastructure.EntityFrameworks;
#nullable disable
namespace ZeroFramework.DeviceCenter.Infrastructure.Migrations
{
[DbContext(typeof(DeviceCenterDbContext))]
partial class DeviceCenterDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.0")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.HasSequence("EntityFrameworkHiLoSequence")
.IncrementsBy(10);
modelBuilder.Entity("ZeroFramework.DeviceCenter.Domain.Aggregates.BuyerAggregate.Buyer", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<Guid>("UserId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("UserId")
.IsUnique();
b.ToTable("Buyers", "dbo");
});
modelBuilder.Entity("ZeroFramework.DeviceCenter.Domain.Aggregates.BuyerAggregate.PaymentMethod", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseHiLo(b.Property<int>("Id"), "EntityFrameworkHiLoSequence");
b.Property<Guid?>("BuyerId")
.HasColumnType("uniqueidentifier");
b.Property<string>("CardNumber")
.IsRequired()
.HasMaxLength(25)
.HasColumnType("nvarchar(25)");
b.Property<string>("CardType")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("nvarchar(20)");
b.Property<DateTimeOffset>("Expiration")
.HasColumnType("datetimeoffset");
b.HasKey("Id");
b.HasIndex("BuyerId");
b.ToTable("PaymentMethods", "dbo");
});
modelBuilder.Entity("ZeroFramework.DeviceCenter.Domain.Aggregates.DeviceAggregate.Device", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"), 100000L);
b.Property<string>("Coordinate")
.HasMaxLength(30)
.HasColumnType("nvarchar(30)");
b.Property<DateTimeOffset>("CreationTime")
.HasColumnType("datetimeoffset");
b.Property<DateTimeOffset?>("LastOnlineTime")
.HasColumnType("datetimeoffset");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("nvarchar(20)");
b.Property<int>("ProductId")
.HasColumnType("int");
b.Property<string>("Remark")
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<string>("Status")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("nvarchar(20)");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.ToTable("Devices", "dbo");
});
modelBuilder.Entity("ZeroFramework.DeviceCenter.Domain.Aggregates.DeviceAggregate.DeviceGroup", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 100000L);
b.Property<DateTimeOffset>("CreationTime")
.HasColumnType("datetimeoffset");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("nvarchar(20)");
b.Property<int?>("ParentId")
.HasColumnType("int");
b.Property<string>("Remark")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("ParentId");
b.ToTable("DeviceGroups", "dbo");
});
modelBuilder.Entity("ZeroFramework.DeviceCenter.Domain.Aggregates.DeviceAggregate.DeviceGrouping", b =>
{
b.Property<long>("DeviceId")
.HasColumnType("bigint");
b.Property<int>("DeviceGroupId")
.HasColumnType("int");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier");
b.HasKey("DeviceId", "DeviceGroupId");
b.HasIndex("DeviceGroupId");
b.ToTable("DeviceGroupings", "dbo");
});
modelBuilder.Entity("ZeroFramework.DeviceCenter.Domain.Aggregates.MonitoringAggregate.MonitoringFactor", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ChineseName")
.IsRequired()
.HasMaxLength(36)
.HasColumnType("nvarchar(36)");
b.Property<int>("Decimals")
.HasColumnType("int");
b.Property<string>("EnglishName")
.IsRequired()
.HasMaxLength(36)
.HasColumnType("nvarchar(36)");
b.Property<string>("FactorCode")
.IsRequired()
.HasMaxLength(36)
.HasColumnType("nvarchar(36)");
b.Property<string>("Remarks")
.HasMaxLength(36)
.HasColumnType("nvarchar(36)");
b.Property<string>("Unit")
.HasMaxLength(36)
.HasColumnType("nvarchar(36)");
b.HasKey("Id");
b.HasIndex("FactorCode")
.IsUnique();
b.ToTable("MonitoringFactors", "dbo");
});
modelBuilder.Entity("ZeroFramework.DeviceCenter.Domain.Aggregates.OrderAggregate.Order", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<Guid>("BuyerId")
.HasColumnType("uniqueidentifier");
b.Property<DateTimeOffset>("CreationTime")
.HasColumnType("datetimeoffset");
b.Property<string>("OrderStatus")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int?>("PaymentMethodId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("BuyerId");
b.HasIndex("PaymentMethodId");
b.ToTable("Orders", "dbo");
});
modelBuilder.Entity("ZeroFramework.DeviceCenter.Domain.Aggregates.OrderAggregate.OrderItem", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("OrderId")
.HasColumnType("uniqueidentifier");
b.Property<int>("ProductId")
.HasColumnType("int");
b.Property<decimal>("UnitPrice")
.HasPrecision(18, 2)
.HasColumnType("decimal(18,2)");
b.Property<int>("Units")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("OrderId");
b.ToTable("OrderItems", "dbo");
});
modelBuilder.Entity("ZeroFramework.DeviceCenter.Domain.Aggregates.OrderAggregate.OrderStatus", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseHiLo(b.Property<int>("Id"), "EntityFrameworkHiLoSequence");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.HasKey("Id");
b.ToTable("OrderStatus", "dbo");
});
modelBuilder.Entity("ZeroFramework.DeviceCenter.Domain.Aggregates.PermissionAggregate.PermissionGrant", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("OperationName")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("nvarchar(255)");
b.Property<string>("ProviderKey")
.IsRequired()
.HasMaxLength(36)
.HasColumnType("nvarchar(36)");
b.Property<string>("ProviderName")
.IsRequired()
.HasMaxLength(36)
.HasColumnType("nvarchar(36)");
b.Property<Guid?>("ResourceGroupId")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("ResourceGroupId");
b.HasIndex("OperationName", "ProviderName", "ProviderKey", "ResourceGroupId", "TenantId")
.IsUnique()
.HasFilter("[ResourceGroupId] IS NOT NULL AND [TenantId] IS NOT NULL");
b.ToTable("PermissionGrants", "dbo");
});
modelBuilder.Entity("ZeroFramework.DeviceCenter.Domain.Aggregates.ProductAggregate.MeasurementUnit", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Remark")
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<string>("Unit")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("nvarchar(20)");
b.Property<string>("UnitName")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("nvarchar(20)");
b.HasKey("Id");
b.ToTable("MeasurementUnits", "dbo");
});
modelBuilder.Entity("ZeroFramework.DeviceCenter.Domain.Aggregates.ProductAggregate.Product", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<DateTimeOffset>("CreationTime")
.HasColumnType("datetimeoffset");
b.Property<string>("DataFormat")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("nvarchar(20)");
b.Property<string>("Features")
.HasColumnType("nvarchar(max)");
b.Property<bool>("IsDeleted")
.HasColumnType("bit");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("nvarchar(20)");
b.Property<string>("NetType")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("nvarchar(20)");
b.Property<string>("NodeType")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("nvarchar(20)");
b.Property<string>("ProtocolType")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("nvarchar(20)");
b.Property<string>("Remark")
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.ToTable("Products", "dbo");
});
modelBuilder.Entity("ZeroFramework.DeviceCenter.Domain.Aggregates.ProjectAggregate.Project", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<DateTimeOffset>("CreationTime")
.HasColumnType("datetimeoffset");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("nvarchar(20)");
b.HasKey("Id");
b.ToTable("Projects", "dbo");
});
modelBuilder.Entity("ZeroFramework.DeviceCenter.Domain.Aggregates.ProjectAggregate.ProjectGroup", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<DateTimeOffset>("CreationTime")
.HasColumnType("datetimeoffset");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("nvarchar(20)");
b.Property<int?>("ParentId")
.HasColumnType("int");
b.Property<int>("ProjectId")
.HasColumnType("int");
b.Property<string>("Remark")
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<int?>("Sorting")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ParentId");
b.HasIndex("ProjectId");
b.ToTable("ProjectGroups", "dbo");
});
modelBuilder.Entity("ZeroFramework.DeviceCenter.Domain.Aggregates.ResourceGroupAggregate.ResourceGroup", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("DisplayName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("nvarchar(20)");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("Name", "TenantId")
.IsUnique()
.HasFilter("[TenantId] IS NOT NULL");
b.ToTable("ResourceGroups", "dbo");
});
modelBuilder.Entity("ZeroFramework.DeviceCenter.Domain.Aggregates.ResourceGroupAggregate.ResourceGrouping", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<Guid>("ResourceGroupId")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("ResourceGroupId");
b.ToTable("ResourceGroupings", "dbo");
});
modelBuilder.Entity("ZeroFramework.DeviceCenter.Infrastructure.Idempotency.ClientRequest", b =>
{
b.Property<string>("Id")
.HasColumnType("nvarchar(450)");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<DateTimeOffset>("Time")
.HasColumnType("datetimeoffset");
b.HasKey("Id");
b.ToTable("Idempotency", "dbo");
});
modelBuilder.Entity("ZeroFramework.DeviceCenter.Infrastructure.IntegrationEvents.IntegrationEventLog", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("Content")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<DateTimeOffset>("CreationTime")
.HasColumnType("datetimeoffset");
b.Property<string>("EventTypeName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("Status")
.HasColumnType("int");
b.Property<int>("TimesSent")
.HasColumnType("int");
b.Property<string>("TransactionId")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("IntegrationEventLogs", "dbo");
});
modelBuilder.Entity("ZeroFramework.DeviceCenter.Domain.Aggregates.BuyerAggregate.PaymentMethod", b =>
{
b.HasOne("ZeroFramework.DeviceCenter.Domain.Aggregates.BuyerAggregate.Buyer", null)
.WithMany("PaymentMethods")
.HasForeignKey("BuyerId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("ZeroFramework.DeviceCenter.Domain.Aggregates.DeviceAggregate.DeviceGroup", b =>
{
b.HasOne("ZeroFramework.DeviceCenter.Domain.Aggregates.DeviceAggregate.DeviceGroup", "Parent")
.WithMany("Children")
.HasForeignKey("ParentId");
b.Navigation("Parent");
});
modelBuilder.Entity("ZeroFramework.DeviceCenter.Domain.Aggregates.DeviceAggregate.DeviceGrouping", b =>
{
b.HasOne("ZeroFramework.DeviceCenter.Domain.Aggregates.DeviceAggregate.DeviceGroup", "DeviceGroup")
.WithMany()
.HasForeignKey("DeviceGroupId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("ZeroFramework.DeviceCenter.Domain.Aggregates.DeviceAggregate.Device", "Device")
.WithMany()
.HasForeignKey("DeviceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Device");
b.Navigation("DeviceGroup");
});
modelBuilder.Entity("ZeroFramework.DeviceCenter.Domain.Aggregates.OrderAggregate.Order", b =>
{
b.HasOne("ZeroFramework.DeviceCenter.Domain.Aggregates.BuyerAggregate.Buyer", null)
.WithMany()
.HasForeignKey("BuyerId");
b.HasOne("ZeroFramework.DeviceCenter.Domain.Aggregates.BuyerAggregate.PaymentMethod", null)
.WithMany()
.HasForeignKey("PaymentMethodId")
.OnDelete(DeleteBehavior.Restrict);
b.OwnsOne("ZeroFramework.DeviceCenter.Domain.Aggregates.OrderAggregate.ShippingAddress", "Address", b1 =>
{
b1.Property<Guid>("OrderId")
.HasColumnType("uniqueidentifier");
b1.Property<string>("City")
.IsRequired()
.HasColumnType("nvarchar(max)");
b1.Property<string>("Country")
.IsRequired()
.HasColumnType("nvarchar(max)");
b1.Property<string>("State")
.IsRequired()
.HasColumnType("nvarchar(max)");
b1.Property<string>("Street")
.IsRequired()
.HasColumnType("nvarchar(max)");
b1.Property<string>("ZipCode")
.IsRequired()
.HasColumnType("nvarchar(max)");
b1.HasKey("OrderId");
b1.ToTable("Orders", "dbo");
b1.WithOwner()
.HasForeignKey("OrderId");
});
b.Navigation("Address")
.IsRequired();
});
modelBuilder.Entity("ZeroFramework.DeviceCenter.Domain.Aggregates.OrderAggregate.OrderItem", b =>
{
b.HasOne("ZeroFramework.DeviceCenter.Domain.Aggregates.OrderAggregate.Order", null)
.WithMany("OrderItems")
.HasForeignKey("OrderId");
});
modelBuilder.Entity("ZeroFramework.DeviceCenter.Domain.Aggregates.PermissionAggregate.PermissionGrant", b =>
{
b.HasOne("ZeroFramework.DeviceCenter.Domain.Aggregates.ResourceGroupAggregate.ResourceGroup", null)
.WithMany()
.HasForeignKey("ResourceGroupId");
});
modelBuilder.Entity("ZeroFramework.DeviceCenter.Domain.Aggregates.ProjectAggregate.ProjectGroup", b =>
{
b.HasOne("ZeroFramework.DeviceCenter.Domain.Aggregates.ProjectAggregate.ProjectGroup", "Parent")
.WithMany("Children")
.HasForeignKey("ParentId");
b.HasOne("ZeroFramework.DeviceCenter.Domain.Aggregates.ProjectAggregate.Project", "Project")
.WithMany("Groups")
.HasForeignKey("ProjectId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Parent");
b.Navigation("Project");
});
modelBuilder.Entity("ZeroFramework.DeviceCenter.Domain.Aggregates.ResourceGroupAggregate.ResourceGrouping", b =>
{
b.HasOne("ZeroFramework.DeviceCenter.Domain.Aggregates.ResourceGroupAggregate.ResourceGroup", null)
.WithMany()
.HasForeignKey("ResourceGroupId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.OwnsOne("ZeroFramework.DeviceCenter.Domain.Aggregates.ResourceGroupAggregate.ResourceDescriptor", "Resource", b1 =>
{
b1.Property<Guid>("ResourceGroupingId")
.HasColumnType("uniqueidentifier");
b1.Property<string>("ResourceId")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("nvarchar(255)")
.HasColumnName("ResourceId");
b1.Property<string>("ResourceType")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("nvarchar(255)")
.HasColumnName("ResourceType");
b1.HasKey("ResourceGroupingId");
b1.ToTable("ResourceGroupings", "dbo");
b1.WithOwner()
.HasForeignKey("ResourceGroupingId");
});
b.Navigation("Resource")
.IsRequired();
});
modelBuilder.Entity("ZeroFramework.DeviceCenter.Domain.Aggregates.BuyerAggregate.Buyer", b =>
{
b.Navigation("PaymentMethods");
});
modelBuilder.Entity("ZeroFramework.DeviceCenter.Domain.Aggregates.DeviceAggregate.DeviceGroup", b =>
{
b.Navigation("Children");
});
modelBuilder.Entity("ZeroFramework.DeviceCenter.Domain.Aggregates.OrderAggregate.Order", b =>
{
b.Navigation("OrderItems");
});
modelBuilder.Entity("ZeroFramework.DeviceCenter.Domain.Aggregates.ProjectAggregate.Project", b =>
{
b.Navigation("Groups");
});
modelBuilder.Entity("ZeroFramework.DeviceCenter.Domain.Aggregates.ProjectAggregate.ProjectGroup", b =>
{
b.Navigation("Children");
});
#pragma warning restore 612, 618
}
}
}