Commit 8ff3faf3 by dingsongjie

完善 backet

parent 38809d97
Showing with 613 additions and 16 deletions
...@@ -41,7 +41,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Product.Api", "samples\apis ...@@ -41,7 +41,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Product.Api", "samples\apis
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Backet.Api", "samples\apis\Backet.Api\Backet.Api.csproj", "{C961F25C-1C11-4855-84E4-ADABE96451E7}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Backet.Api", "samples\apis\Backet.Api\Backet.Api.csproj", "{C961F25C-1C11-4855-84E4-ADABE96451E7}"
EndProject 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 EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
...@@ -109,6 +113,10 @@ Global ...@@ -109,6 +113,10 @@ Global
{F65858EC-C34F-4121-BEC5-4E20DEA74A0A}.Debug|Any CPU.Build.0 = Debug|Any CPU {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.ActiveCfg = Release|Any CPU
{F65858EC-C34F-4121-BEC5-4E20DEA74A0A}.Release|Any CPU.Build.0 = 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 EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
...@@ -131,6 +139,8 @@ Global ...@@ -131,6 +139,8 @@ Global
{125B1E4B-B1C1-4F85-9C6A-38815960E654} = {475116FC-DEEC-4255-94E4-AE7B8C85038D} {125B1E4B-B1C1-4F85-9C6A-38815960E654} = {475116FC-DEEC-4255-94E4-AE7B8C85038D}
{C961F25C-1C11-4855-84E4-ADABE96451E7} = {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} {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 EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {DB0775A3-F293-4043-ADB7-72BAC081E87E} SolutionGuid = {DB0775A3-F293-4043-ADB7-72BAC081E87E}
......
using Pole.Application.EventBus; using Pole.Application.EventBus;
using Pole.ReliableMessage.Abstraction; using Pole.ReliableMessage.Abstraction;
using Product.Api.Application.IntergrationEvent; using Product.IntegrationEvents;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
...@@ -16,6 +16,14 @@ namespace Backet.Api.Application.IntegrationEvent.Handler ...@@ -16,6 +16,14 @@ namespace Backet.Api.Application.IntegrationEvent.Handler
public override Task Handle(IReliableEventHandlerContext<ProductAddedIntegrationEvent> context) public override Task Handle(IReliableEventHandlerContext<ProductAddedIntegrationEvent> context)
{ {
try
{
}
catch(Exception ex)
{
}
return Task.FromResult(1); return Task.FromResult(1);
} }
} }
......
...@@ -5,7 +5,18 @@ ...@@ -5,7 +5,18 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Compile Remove="Migrations\20200117082211_Init.cs" />
<Compile Remove="Migrations\20200117082211_Init.Designer.cs" />
<Compile Remove="Migrations\20200117091659_Set_Backet_BacketItem_IsRequired_false.cs" />
<Compile Remove="Migrations\20200117091659_Set_Backet_BacketItem_IsRequired_false.Designer.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.0" /> <PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="3.1.0" /> <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="3.1.0" />
</ItemGroup> </ItemGroup>
...@@ -15,10 +26,7 @@ ...@@ -15,10 +26,7 @@
<ProjectReference Include="..\..\..\src\Pole.Grpc\Pole.Grpc.csproj" /> <ProjectReference Include="..\..\..\src\Pole.Grpc\Pole.Grpc.csproj" />
<ProjectReference Include="..\..\..\src\Pole.ReliableMessage.Masstransit\Pole.ReliableMessage.Masstransit.csproj" /> <ProjectReference Include="..\..\..\src\Pole.ReliableMessage.Masstransit\Pole.ReliableMessage.Masstransit.csproj" />
<ProjectReference Include="..\..\..\src\Pole.ReliableMessage.Storage.Mongodb\Pole.ReliableMessage.Storage.Mongodb.csproj" /> <ProjectReference Include="..\..\..\src\Pole.ReliableMessage.Storage.Mongodb\Pole.ReliableMessage.Storage.Mongodb.csproj" />
</ItemGroup> <ProjectReference Include="..\..\intergrationEvents\Product.IntegrationEvents\Product.IntegrationEvents.csproj" />
<ItemGroup>
<Folder Include="Domain\AggregatesModel\" />
</ItemGroup> </ItemGroup>
</Project> </Project>
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<BacketItem> BacketItems { get; private set; }
public long TotalPrice { get; set; }
}
}
using System; using Pole.Domain;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; 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 string ProductName { get; set; }
public long Price { get; set; } public long Price { get; set; }
} }
......
using Microsoft.EntityFrameworkCore; using Backet.Api.Domain.AggregatesModel.BacketAggregate;
using Backet.Api.Infrastructure.EntityConfigurations;
using Microsoft.EntityFrameworkCore;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
...@@ -12,9 +14,14 @@ namespace Backet.Api.Infrastructure ...@@ -12,9 +14,14 @@ namespace Backet.Api.Infrastructure
{ {
} }
public DbSet<Backet.Api.Domain.AggregatesModel.BacketAggregate.Backet> Backets { get; set; }
public DbSet<BacketItem> BacketItems { get; set; }
protected override void OnModelCreating(ModelBuilder builder) protected override void OnModelCreating(ModelBuilder builder)
{ {
base.OnModelCreating(builder); base.OnModelCreating(builder);
builder.ApplyConfiguration(new BacketItemEntityTypeConfiguration());
builder.ApplyConfiguration(new BacketEntityTypeConfiguration());
} }
} }
} }
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<Backet.Api.Domain.AggregatesModel.BacketAggregate.Backet>
{
public void Configure(EntityTypeBuilder<Backet.Api.Domain.AggregatesModel.BacketAggregate.Backet> 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);
}
}
}
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<BacketItem>
{
public void Configure(EntityTypeBuilder<BacketItem> 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);
}
}
}
// <auto-generated />
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<string>("UserId")
.HasColumnType("character varying(32)")
.HasMaxLength(32);
b.Property<string>("Id")
.HasColumnType("character varying(32)")
.HasMaxLength(32);
b.Property<long>("TotalPrice")
.HasColumnType("bigint");
b.HasKey("UserId");
b.ToTable("Backet");
});
modelBuilder.Entity("Backet.Api.Domain.AggregatesModel.BacketAggregate.BacketItem", b =>
{
b.Property<string>("ProductId")
.HasColumnType("character varying(32)")
.HasMaxLength(32);
b.Property<string>("BacketUserId")
.HasColumnType("character varying(32)");
b.Property<string>("Id")
.HasColumnType("character varying(32)")
.HasMaxLength(32);
b.Property<long>("Price")
.HasColumnType("bigint");
b.Property<string>("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
}
}
}
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<string>(maxLength: 32, nullable: false),
Id = table.Column<string>(maxLength: 32, nullable: true),
TotalPrice = table.Column<long>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Backet", x => x.UserId);
});
migrationBuilder.CreateTable(
name: "BacketItem",
columns: table => new
{
ProductId = table.Column<string>(maxLength: 32, nullable: false),
Id = table.Column<string>(maxLength: 32, nullable: true),
ProductName = table.Column<string>(maxLength: 256, nullable: false),
Price = table.Column<long>(nullable: false),
BacketUserId = table.Column<string>(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");
}
}
}
// <auto-generated />
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<string>("Id")
.HasColumnType("character varying(32)")
.HasMaxLength(32);
b.Property<long>("TotalPrice")
.HasColumnType("bigint");
b.Property<string>("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<string>("Id")
.HasColumnType("character varying(32)")
.HasMaxLength(32);
b.Property<string>("BacketId")
.HasColumnType("character varying(32)");
b.Property<long>("Price")
.HasColumnType("bigint");
b.Property<string>("ProductId")
.HasColumnType("character varying(32)")
.HasMaxLength(32);
b.Property<string>("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
}
}
}
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<string>(
name: "Id",
table: "BacketItem",
maxLength: 32,
nullable: false,
oldClrType: typeof(string),
oldType: "character varying(32)",
oldMaxLength: 32,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "ProductId",
table: "BacketItem",
maxLength: 32,
nullable: true,
oldClrType: typeof(string),
oldType: "character varying(32)",
oldMaxLength: 32);
migrationBuilder.AddColumn<string>(
name: "BacketId",
table: "BacketItem",
nullable: true);
migrationBuilder.AlterColumn<string>(
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<string>(
name: "ProductId",
table: "BacketItem",
type: "character varying(32)",
maxLength: 32,
nullable: false,
oldClrType: typeof(string),
oldMaxLength: 32,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Id",
table: "BacketItem",
type: "character varying(32)",
maxLength: 32,
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 32);
migrationBuilder.AddColumn<string>(
name: "BacketUserId",
table: "BacketItem",
type: "character varying(32)",
nullable: true);
migrationBuilder.AlterColumn<string>(
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);
}
}
}
// <auto-generated />
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<string>("Id")
.HasColumnType("character varying(32)")
.HasMaxLength(32);
b.Property<long>("TotalPrice")
.HasColumnType("bigint");
b.Property<string>("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<string>("Id")
.HasColumnType("character varying(32)")
.HasMaxLength(32);
b.Property<string>("BacketId")
.HasColumnType("character varying(32)");
b.Property<long>("Price")
.HasColumnType("bigint");
b.Property<string>("ProductId")
.HasColumnType("character varying(32)")
.HasMaxLength(32);
b.Property<string>("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
}
}
}
using Pole.Application.EventBus; using Pole.Application.EventBus;
using Pole.Domain; using Pole.Domain;
using Product.Api.Application.IntergrationEvent;
using Product.Api.Domain.Event; using Product.Api.Domain.Event;
using Product.Api.Domain.ProductAggregate; using Product.Api.Domain.ProductAggregate;
using Product.IntegrationEvents;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
......
using Pole.ReliableMessage.Abstraction; using Pole.ReliableMessage.Abstraction;
using Product.Api.Application.IntergrationEvent;
using Product.Api.Application.Query.Abstraction; using Product.Api.Application.Query.Abstraction;
using Product.Api.Domain.ProductAggregate; using Product.Api.Domain.ProductAggregate;
using Product.IntegrationEvents;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
......
...@@ -27,5 +27,6 @@ ...@@ -27,5 +27,6 @@
<ProjectReference Include="..\..\..\src\Pole.ReliableMessage.Masstransit\Pole.ReliableMessage.Masstransit.csproj" /> <ProjectReference Include="..\..\..\src\Pole.ReliableMessage.Masstransit\Pole.ReliableMessage.Masstransit.csproj" />
<ProjectReference Include="..\..\..\src\Pole.ReliableMessage.Storage.Mongodb\Pole.ReliableMessage.Storage.Mongodb.csproj" /> <ProjectReference Include="..\..\..\src\Pole.ReliableMessage.Storage.Mongodb\Pole.ReliableMessage.Storage.Mongodb.csproj" />
<ProjectReference Include="..\..\..\src\Pole.ReliableMessage\Pole.ReliableMessage.csproj" /> <ProjectReference Include="..\..\..\src\Pole.ReliableMessage\Pole.ReliableMessage.csproj" />
<ProjectReference Include="..\..\intergrationEvents\Product.IntegrationEvents\Product.IntegrationEvents.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>
\ No newline at end of file
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
</Project>
...@@ -3,7 +3,7 @@ using System.Collections.Generic; ...@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Product.Api.Application.IntergrationEvent namespace Product.IntegrationEvents
{ {
public class ProductAddedIntegrationEvent public class ProductAddedIntegrationEvent
{ {
......
...@@ -11,10 +11,10 @@ namespace Pole.ReliableMessage.EventBus ...@@ -11,10 +11,10 @@ namespace Pole.ReliableMessage.EventBus
{ {
public List<Type> FindAll(IEnumerable<Assembly> assemblies) public List<Type> FindAll(IEnumerable<Assembly> assemblies)
{ {
var eventType = typeof(IReliableEventCallback); var callbackType = typeof(IReliableEventCallback);
var eventTypes = assemblies.SelectMany(m => m.GetTypes().Where(type => eventType.IsAssignableFrom(type))); var callbackTypes = assemblies.SelectMany(m => m.GetTypes().Where(type => callbackType.IsAssignableFrom(type)));
return eventTypes.ToList(); ; return callbackTypes.ToList(); ;
} }
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment