diff --git a/Pole.sln b/Pole.sln index ed916f6..1e22943 100644 --- a/Pole.sln +++ b/Pole.sln @@ -41,7 +41,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Product.Api", "samples\apis EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Backet.Api", "samples\apis\Backet.Api\Backet.Api.csproj", "{C961F25C-1C11-4855-84E4-ADABE96451E7}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "User.Api", "samples\apis\User.Api\User.Api.csproj", "{F65858EC-C34F-4121-BEC5-4E20DEA74A0A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "User.Api", "samples\apis\User.Api\User.Api.csproj", "{F65858EC-C34F-4121-BEC5-4E20DEA74A0A}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "integrationEvents", "integrationEvents", "{74422E64-29FE-4287-A86E-741D1DFF6698}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Product.IntegrationEvents", "samples\intergrationEvents\Product.IntegrationEvents\Product.IntegrationEvents.csproj", "{9C0DFC90-1AF9-424A-B5FB-2A7C3611970C}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -109,6 +113,10 @@ Global {F65858EC-C34F-4121-BEC5-4E20DEA74A0A}.Debug|Any CPU.Build.0 = Debug|Any CPU {F65858EC-C34F-4121-BEC5-4E20DEA74A0A}.Release|Any CPU.ActiveCfg = Release|Any CPU {F65858EC-C34F-4121-BEC5-4E20DEA74A0A}.Release|Any CPU.Build.0 = Release|Any CPU + {9C0DFC90-1AF9-424A-B5FB-2A7C3611970C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9C0DFC90-1AF9-424A-B5FB-2A7C3611970C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9C0DFC90-1AF9-424A-B5FB-2A7C3611970C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9C0DFC90-1AF9-424A-B5FB-2A7C3611970C}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -131,6 +139,8 @@ Global {125B1E4B-B1C1-4F85-9C6A-38815960E654} = {475116FC-DEEC-4255-94E4-AE7B8C85038D} {C961F25C-1C11-4855-84E4-ADABE96451E7} = {475116FC-DEEC-4255-94E4-AE7B8C85038D} {F65858EC-C34F-4121-BEC5-4E20DEA74A0A} = {475116FC-DEEC-4255-94E4-AE7B8C85038D} + {74422E64-29FE-4287-A86E-741D1DFF6698} = {4A0FB696-EC29-4A5F-B40B-A6FC56001ADB} + {9C0DFC90-1AF9-424A-B5FB-2A7C3611970C} = {74422E64-29FE-4287-A86E-741D1DFF6698} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {DB0775A3-F293-4043-ADB7-72BAC081E87E} diff --git a/samples/apis/Backet.Api/Application/IntegrationEvent/Handler/JustTestWhenProductAddedIntegrationEventHandler.cs b/samples/apis/Backet.Api/Application/IntegrationEvent/Handler/JustTestWhenProductAddedIntegrationEventHandler.cs index 22c6055..5cd3d65 100644 --- a/samples/apis/Backet.Api/Application/IntegrationEvent/Handler/JustTestWhenProductAddedIntegrationEventHandler.cs +++ b/samples/apis/Backet.Api/Application/IntegrationEvent/Handler/JustTestWhenProductAddedIntegrationEventHandler.cs @@ -1,6 +1,6 @@ using Pole.Application.EventBus; using Pole.ReliableMessage.Abstraction; -using Product.Api.Application.IntergrationEvent; +using Product.IntegrationEvents; using System; using System.Collections.Generic; using System.Linq; @@ -16,6 +16,14 @@ namespace Backet.Api.Application.IntegrationEvent.Handler public override Task Handle(IReliableEventHandlerContext context) { + try + { + + } + catch(Exception ex) + { + + } return Task.FromResult(1); } } diff --git a/samples/apis/Backet.Api/Backet.Api.csproj b/samples/apis/Backet.Api/Backet.Api.csproj index 4c80c39..a084f9d 100644 --- a/samples/apis/Backet.Api/Backet.Api.csproj +++ b/samples/apis/Backet.Api/Backet.Api.csproj @@ -5,7 +5,18 @@ + + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + @@ -15,10 +26,7 @@ - - - - + diff --git a/samples/apis/Backet.Api/Domain/AggregatesModel/BacketAggregate/Backet.cs b/samples/apis/Backet.Api/Domain/AggregatesModel/BacketAggregate/Backet.cs new file mode 100644 index 0000000..337d40f --- /dev/null +++ b/samples/apis/Backet.Api/Domain/AggregatesModel/BacketAggregate/Backet.cs @@ -0,0 +1,15 @@ +using Pole.Domain; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace Backet.Api.Domain.AggregatesModel.BacketAggregate +{ + public class Backet: Entity,IAggregateRoot + { + public string UserId { get; set; } + public IReadOnlyCollection BacketItems { get; private set; } + public long TotalPrice { get; set; } + } +} diff --git a/samples/apis/Product.Api/Application/IntegrationEvent/ProductAddedIntegrationEvent.cs b/samples/apis/Backet.Api/Domain/AggregatesModel/BacketAggregate/BacketItem.cs similarity index 69% rename from samples/apis/Product.Api/Application/IntegrationEvent/ProductAddedIntegrationEvent.cs rename to samples/apis/Backet.Api/Domain/AggregatesModel/BacketAggregate/BacketItem.cs index 5a9ec41..d9c54ae 100644 --- a/samples/apis/Product.Api/Application/IntegrationEvent/ProductAddedIntegrationEvent.cs +++ b/samples/apis/Backet.Api/Domain/AggregatesModel/BacketAggregate/BacketItem.cs @@ -1,12 +1,14 @@ -using System; +using Pole.Domain; +using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -namespace Product.Api.Application.IntergrationEvent +namespace Backet.Api.Domain.AggregatesModel.BacketAggregate { - public class ProductAddedIntegrationEvent + public class BacketItem : Entity { + public string ProductId { get; set; } public string ProductName { get; set; } public long Price { get; set; } } diff --git a/samples/apis/Backet.Api/Infrastructure/BacketDbContext.cs b/samples/apis/Backet.Api/Infrastructure/BacketDbContext.cs index 3bafcfb..c492348 100644 --- a/samples/apis/Backet.Api/Infrastructure/BacketDbContext.cs +++ b/samples/apis/Backet.Api/Infrastructure/BacketDbContext.cs @@ -1,4 +1,6 @@ -using Microsoft.EntityFrameworkCore; +using Backet.Api.Domain.AggregatesModel.BacketAggregate; +using Backet.Api.Infrastructure.EntityConfigurations; +using Microsoft.EntityFrameworkCore; using System; using System.Collections.Generic; using System.Linq; @@ -12,9 +14,14 @@ namespace Backet.Api.Infrastructure { } + public DbSet Backets { get; set; } + public DbSet BacketItems { get; set; } protected override void OnModelCreating(ModelBuilder builder) { base.OnModelCreating(builder); + + builder.ApplyConfiguration(new BacketItemEntityTypeConfiguration()); + builder.ApplyConfiguration(new BacketEntityTypeConfiguration()); } } } diff --git a/samples/apis/Backet.Api/Infrastructure/EntityConfigurations/BacketEntityTypeConfiguration.cs b/samples/apis/Backet.Api/Infrastructure/EntityConfigurations/BacketEntityTypeConfiguration.cs new file mode 100644 index 0000000..f4e5996 --- /dev/null +++ b/samples/apis/Backet.Api/Infrastructure/EntityConfigurations/BacketEntityTypeConfiguration.cs @@ -0,0 +1,26 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace Backet.Api.Infrastructure.EntityConfigurations +{ + public class BacketEntityTypeConfiguration : IEntityTypeConfiguration + { + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable(nameof(Backet.Api.Domain.AggregatesModel.BacketAggregate.Backet)); + + builder.Property(m => m.Id).HasMaxLength(32); + builder.Property(m => m.UserId).HasMaxLength(32).IsRequired(); + builder.HasMany(m => m.BacketItems).WithOne(); + + builder.Ignore(m => m.DomainEvents); + + builder.HasKey(m => m.Id); + builder.HasIndex(m => m.UserId); + } + } +} diff --git a/samples/apis/Backet.Api/Infrastructure/EntityConfigurations/BacketItemEntityTypeConfiguration.cs b/samples/apis/Backet.Api/Infrastructure/EntityConfigurations/BacketItemEntityTypeConfiguration.cs new file mode 100644 index 0000000..51dff27 --- /dev/null +++ b/samples/apis/Backet.Api/Infrastructure/EntityConfigurations/BacketItemEntityTypeConfiguration.cs @@ -0,0 +1,27 @@ +using Backet.Api.Domain.AggregatesModel.BacketAggregate; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace Backet.Api.Infrastructure.EntityConfigurations +{ + public class BacketItemEntityTypeConfiguration : IEntityTypeConfiguration + { + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable(nameof(BacketItem)); + + builder.Property(m => m.Id).HasMaxLength(32); + builder.Property(m => m.ProductId).HasMaxLength(32); + builder.Property(m => m.ProductName).HasMaxLength(256).IsRequired(); + + builder.Ignore(m => m.DomainEvents); + + builder.HasKey(m => m.Id); + builder.HasIndex(m => m.ProductId); + } + } +} diff --git a/samples/apis/Backet.Api/Migrations/20200117083109_Init.Designer.cs b/samples/apis/Backet.Api/Migrations/20200117083109_Init.Designer.cs new file mode 100644 index 0000000..b18e7f0 --- /dev/null +++ b/samples/apis/Backet.Api/Migrations/20200117083109_Init.Designer.cs @@ -0,0 +1,78 @@ +// +using Backet.Api.Infrastructure; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +namespace Backet.Api.Migrations +{ + [DbContext(typeof(BacketDbContext))] + [Migration("20200117083109_Init")] + partial class Init + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn) + .HasAnnotation("ProductVersion", "3.1.0") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + modelBuilder.Entity("Backet.Api.Domain.AggregatesModel.BacketAggregate.Backet", b => + { + b.Property("UserId") + .HasColumnType("character varying(32)") + .HasMaxLength(32); + + b.Property("Id") + .HasColumnType("character varying(32)") + .HasMaxLength(32); + + b.Property("TotalPrice") + .HasColumnType("bigint"); + + b.HasKey("UserId"); + + b.ToTable("Backet"); + }); + + modelBuilder.Entity("Backet.Api.Domain.AggregatesModel.BacketAggregate.BacketItem", b => + { + b.Property("ProductId") + .HasColumnType("character varying(32)") + .HasMaxLength(32); + + b.Property("BacketUserId") + .HasColumnType("character varying(32)"); + + b.Property("Id") + .HasColumnType("character varying(32)") + .HasMaxLength(32); + + b.Property("Price") + .HasColumnType("bigint"); + + b.Property("ProductName") + .IsRequired() + .HasColumnType("character varying(256)") + .HasMaxLength(256); + + b.HasKey("ProductId"); + + b.HasIndex("BacketUserId"); + + b.ToTable("BacketItem"); + }); + + modelBuilder.Entity("Backet.Api.Domain.AggregatesModel.BacketAggregate.BacketItem", b => + { + b.HasOne("Backet.Api.Domain.AggregatesModel.BacketAggregate.Backet", null) + .WithMany("BacketItems") + .HasForeignKey("BacketUserId"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/samples/apis/Backet.Api/Migrations/20200117083109_Init.cs b/samples/apis/Backet.Api/Migrations/20200117083109_Init.cs new file mode 100644 index 0000000..1dcfa26 --- /dev/null +++ b/samples/apis/Backet.Api/Migrations/20200117083109_Init.cs @@ -0,0 +1,58 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Backet.Api.Migrations +{ + public partial class Init : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Backet", + columns: table => new + { + UserId = table.Column(maxLength: 32, nullable: false), + Id = table.Column(maxLength: 32, nullable: true), + TotalPrice = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Backet", x => x.UserId); + }); + + migrationBuilder.CreateTable( + name: "BacketItem", + columns: table => new + { + ProductId = table.Column(maxLength: 32, nullable: false), + Id = table.Column(maxLength: 32, nullable: true), + ProductName = table.Column(maxLength: 256, nullable: false), + Price = table.Column(nullable: false), + BacketUserId = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_BacketItem", x => x.ProductId); + table.ForeignKey( + name: "FK_BacketItem_Backet_BacketUserId", + column: x => x.BacketUserId, + principalTable: "Backet", + principalColumn: "UserId", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateIndex( + name: "IX_BacketItem_BacketUserId", + table: "BacketItem", + column: "BacketUserId"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "BacketItem"); + + migrationBuilder.DropTable( + name: "Backet"); + } + } +} diff --git a/samples/apis/Backet.Api/Migrations/20200117083456_Modify_Backet_Key.Designer.cs b/samples/apis/Backet.Api/Migrations/20200117083456_Modify_Backet_Key.Designer.cs new file mode 100644 index 0000000..8b9855b --- /dev/null +++ b/samples/apis/Backet.Api/Migrations/20200117083456_Modify_Backet_Key.Designer.cs @@ -0,0 +1,83 @@ +// +using Backet.Api.Infrastructure; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +namespace Backet.Api.Migrations +{ + [DbContext(typeof(BacketDbContext))] + [Migration("20200117083456_Modify_Backet_Key")] + partial class Modify_Backet_Key + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn) + .HasAnnotation("ProductVersion", "3.1.0") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + modelBuilder.Entity("Backet.Api.Domain.AggregatesModel.BacketAggregate.Backet", b => + { + b.Property("Id") + .HasColumnType("character varying(32)") + .HasMaxLength(32); + + b.Property("TotalPrice") + .HasColumnType("bigint"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("character varying(32)") + .HasMaxLength(32); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Backet"); + }); + + modelBuilder.Entity("Backet.Api.Domain.AggregatesModel.BacketAggregate.BacketItem", b => + { + b.Property("Id") + .HasColumnType("character varying(32)") + .HasMaxLength(32); + + b.Property("BacketId") + .HasColumnType("character varying(32)"); + + b.Property("Price") + .HasColumnType("bigint"); + + b.Property("ProductId") + .HasColumnType("character varying(32)") + .HasMaxLength(32); + + b.Property("ProductName") + .IsRequired() + .HasColumnType("character varying(256)") + .HasMaxLength(256); + + b.HasKey("Id"); + + b.HasIndex("BacketId"); + + b.HasIndex("ProductId"); + + b.ToTable("BacketItem"); + }); + + modelBuilder.Entity("Backet.Api.Domain.AggregatesModel.BacketAggregate.BacketItem", b => + { + b.HasOne("Backet.Api.Domain.AggregatesModel.BacketAggregate.Backet", null) + .WithMany("BacketItems") + .HasForeignKey("BacketId"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/samples/apis/Backet.Api/Migrations/20200117083456_Modify_Backet_Key.cs b/samples/apis/Backet.Api/Migrations/20200117083456_Modify_Backet_Key.cs new file mode 100644 index 0000000..29b0c2d --- /dev/null +++ b/samples/apis/Backet.Api/Migrations/20200117083456_Modify_Backet_Key.cs @@ -0,0 +1,185 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Backet.Api.Migrations +{ + public partial class Modify_Backet_Key : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_BacketItem_Backet_BacketUserId", + table: "BacketItem"); + + migrationBuilder.DropPrimaryKey( + name: "PK_BacketItem", + table: "BacketItem"); + + migrationBuilder.DropIndex( + name: "IX_BacketItem_BacketUserId", + table: "BacketItem"); + + migrationBuilder.DropPrimaryKey( + name: "PK_Backet", + table: "Backet"); + + migrationBuilder.DropColumn( + name: "BacketUserId", + table: "BacketItem"); + + migrationBuilder.AlterColumn( + name: "Id", + table: "BacketItem", + maxLength: 32, + nullable: false, + oldClrType: typeof(string), + oldType: "character varying(32)", + oldMaxLength: 32, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ProductId", + table: "BacketItem", + maxLength: 32, + nullable: true, + oldClrType: typeof(string), + oldType: "character varying(32)", + oldMaxLength: 32); + + migrationBuilder.AddColumn( + name: "BacketId", + table: "BacketItem", + nullable: true); + + migrationBuilder.AlterColumn( + name: "Id", + table: "Backet", + maxLength: 32, + nullable: false, + oldClrType: typeof(string), + oldType: "character varying(32)", + oldMaxLength: 32, + oldNullable: true); + + migrationBuilder.AddPrimaryKey( + name: "PK_BacketItem", + table: "BacketItem", + column: "Id"); + + migrationBuilder.AddPrimaryKey( + name: "PK_Backet", + table: "Backet", + column: "Id"); + + migrationBuilder.CreateIndex( + name: "IX_BacketItem_BacketId", + table: "BacketItem", + column: "BacketId"); + + migrationBuilder.CreateIndex( + name: "IX_BacketItem_ProductId", + table: "BacketItem", + column: "ProductId"); + + migrationBuilder.CreateIndex( + name: "IX_Backet_UserId", + table: "Backet", + column: "UserId"); + + migrationBuilder.AddForeignKey( + name: "FK_BacketItem_Backet_BacketId", + table: "BacketItem", + column: "BacketId", + principalTable: "Backet", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_BacketItem_Backet_BacketId", + table: "BacketItem"); + + migrationBuilder.DropPrimaryKey( + name: "PK_BacketItem", + table: "BacketItem"); + + migrationBuilder.DropIndex( + name: "IX_BacketItem_BacketId", + table: "BacketItem"); + + migrationBuilder.DropIndex( + name: "IX_BacketItem_ProductId", + table: "BacketItem"); + + migrationBuilder.DropPrimaryKey( + name: "PK_Backet", + table: "Backet"); + + migrationBuilder.DropIndex( + name: "IX_Backet_UserId", + table: "Backet"); + + migrationBuilder.DropColumn( + name: "BacketId", + table: "BacketItem"); + + migrationBuilder.AlterColumn( + name: "ProductId", + table: "BacketItem", + type: "character varying(32)", + maxLength: 32, + nullable: false, + oldClrType: typeof(string), + oldMaxLength: 32, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "Id", + table: "BacketItem", + type: "character varying(32)", + maxLength: 32, + nullable: true, + oldClrType: typeof(string), + oldMaxLength: 32); + + migrationBuilder.AddColumn( + name: "BacketUserId", + table: "BacketItem", + type: "character varying(32)", + nullable: true); + + migrationBuilder.AlterColumn( + name: "Id", + table: "Backet", + type: "character varying(32)", + maxLength: 32, + nullable: true, + oldClrType: typeof(string), + oldMaxLength: 32); + + migrationBuilder.AddPrimaryKey( + name: "PK_BacketItem", + table: "BacketItem", + column: "ProductId"); + + migrationBuilder.AddPrimaryKey( + name: "PK_Backet", + table: "Backet", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_BacketItem_BacketUserId", + table: "BacketItem", + column: "BacketUserId"); + + migrationBuilder.AddForeignKey( + name: "FK_BacketItem_Backet_BacketUserId", + table: "BacketItem", + column: "BacketUserId", + principalTable: "Backet", + principalColumn: "UserId", + onDelete: ReferentialAction.Restrict); + } + } +} diff --git a/samples/apis/Backet.Api/Migrations/BacketDbContextModelSnapshot.cs b/samples/apis/Backet.Api/Migrations/BacketDbContextModelSnapshot.cs new file mode 100644 index 0000000..a6b706d --- /dev/null +++ b/samples/apis/Backet.Api/Migrations/BacketDbContextModelSnapshot.cs @@ -0,0 +1,81 @@ +// +using Backet.Api.Infrastructure; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +namespace Backet.Api.Migrations +{ + [DbContext(typeof(BacketDbContext))] + partial class BacketDbContextModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn) + .HasAnnotation("ProductVersion", "3.1.0") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + modelBuilder.Entity("Backet.Api.Domain.AggregatesModel.BacketAggregate.Backet", b => + { + b.Property("Id") + .HasColumnType("character varying(32)") + .HasMaxLength(32); + + b.Property("TotalPrice") + .HasColumnType("bigint"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("character varying(32)") + .HasMaxLength(32); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Backet"); + }); + + modelBuilder.Entity("Backet.Api.Domain.AggregatesModel.BacketAggregate.BacketItem", b => + { + b.Property("Id") + .HasColumnType("character varying(32)") + .HasMaxLength(32); + + b.Property("BacketId") + .HasColumnType("character varying(32)"); + + b.Property("Price") + .HasColumnType("bigint"); + + b.Property("ProductId") + .HasColumnType("character varying(32)") + .HasMaxLength(32); + + b.Property("ProductName") + .IsRequired() + .HasColumnType("character varying(256)") + .HasMaxLength(256); + + b.HasKey("Id"); + + b.HasIndex("BacketId"); + + b.HasIndex("ProductId"); + + b.ToTable("BacketItem"); + }); + + modelBuilder.Entity("Backet.Api.Domain.AggregatesModel.BacketAggregate.BacketItem", b => + { + b.HasOne("Backet.Api.Domain.AggregatesModel.BacketAggregate.Backet", null) + .WithMany("BacketItems") + .HasForeignKey("BacketId"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/samples/apis/Product.Api/Application/DomainEventHandler/AddDefaultProductWhenProductTypeAdded2DomainEventHandler.cs b/samples/apis/Product.Api/Application/DomainEventHandler/AddDefaultProductWhenProductTypeAdded2DomainEventHandler.cs index 592d1d7..dbd6661 100644 --- a/samples/apis/Product.Api/Application/DomainEventHandler/AddDefaultProductWhenProductTypeAdded2DomainEventHandler.cs +++ b/samples/apis/Product.Api/Application/DomainEventHandler/AddDefaultProductWhenProductTypeAdded2DomainEventHandler.cs @@ -1,8 +1,8 @@ using Pole.Application.EventBus; using Pole.Domain; -using Product.Api.Application.IntergrationEvent; using Product.Api.Domain.Event; using Product.Api.Domain.ProductAggregate; +using Product.IntegrationEvents; using System; using System.Collections.Generic; using System.Linq; diff --git a/samples/apis/Product.Api/Application/IntegrationEvent/CallBack/ProductAddedIntegrationEventCallback.cs b/samples/apis/Product.Api/Application/IntegrationEvent/CallBack/ProductAddedIntegrationEventCallback.cs index edc62b1..32a05ba 100644 --- a/samples/apis/Product.Api/Application/IntegrationEvent/CallBack/ProductAddedIntegrationEventCallback.cs +++ b/samples/apis/Product.Api/Application/IntegrationEvent/CallBack/ProductAddedIntegrationEventCallback.cs @@ -1,7 +1,7 @@ using Pole.ReliableMessage.Abstraction; -using Product.Api.Application.IntergrationEvent; using Product.Api.Application.Query.Abstraction; using Product.Api.Domain.ProductAggregate; +using Product.IntegrationEvents; using System; using System.Collections.Generic; using System.Linq; diff --git a/samples/apis/Product.Api/Product.Api.csproj b/samples/apis/Product.Api/Product.Api.csproj index c1fc8f6..1354fc2 100644 --- a/samples/apis/Product.Api/Product.Api.csproj +++ b/samples/apis/Product.Api/Product.Api.csproj @@ -27,5 +27,6 @@ + \ No newline at end of file diff --git a/samples/intergrationEvents/Product.IntegrationEvents/Product.IntegrationEvents.csproj b/samples/intergrationEvents/Product.IntegrationEvents/Product.IntegrationEvents.csproj new file mode 100644 index 0000000..9f5c4f4 --- /dev/null +++ b/samples/intergrationEvents/Product.IntegrationEvents/Product.IntegrationEvents.csproj @@ -0,0 +1,7 @@ + + + + netstandard2.0 + + + diff --git a/samples/apis/Backet.Api/Application/IntegrationEvent/ProductAddedIntegrationEvent.cs b/samples/intergrationEvents/Product.IntegrationEvents/ProductAddedIntegrationEvent.cs similarity index 91% rename from samples/apis/Backet.Api/Application/IntegrationEvent/ProductAddedIntegrationEvent.cs rename to samples/intergrationEvents/Product.IntegrationEvents/ProductAddedIntegrationEvent.cs index 5a9ec41..c39a231 100644 --- a/samples/apis/Backet.Api/Application/IntegrationEvent/ProductAddedIntegrationEvent.cs +++ b/samples/intergrationEvents/Product.IntegrationEvents/ProductAddedIntegrationEvent.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -namespace Product.Api.Application.IntergrationEvent +namespace Product.IntegrationEvents { public class ProductAddedIntegrationEvent { diff --git a/src/Pole.ReliableMessage/EventBus/DefaultReliableEventFinder.cs b/src/Pole.ReliableMessage/EventBus/DefaultReliableEventFinder.cs index 9d1f187..2665937 100644 --- a/src/Pole.ReliableMessage/EventBus/DefaultReliableEventFinder.cs +++ b/src/Pole.ReliableMessage/EventBus/DefaultReliableEventFinder.cs @@ -11,10 +11,10 @@ namespace Pole.ReliableMessage.EventBus { public List FindAll(IEnumerable assemblies) { - var eventType = typeof(IReliableEventCallback); + var callbackType = typeof(IReliableEventCallback); - var eventTypes = assemblies.SelectMany(m => m.GetTypes().Where(type => eventType.IsAssignableFrom(type))); - return eventTypes.ToList(); ; + var callbackTypes = assemblies.SelectMany(m => m.GetTypes().Where(type => callbackType.IsAssignableFrom(type))); + return callbackTypes.ToList(); ; } } }