-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
afc63a6
commit 655fa95
Showing
5 changed files
with
94 additions
and
1 deletion.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
Src/Product.Domain/Aggregates/Shared/User/AggregateRoot/UserModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
Src/Product.Infrastructure/Data/EntitytypeConfigurations/Category/CategoryConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using Microsoft.EntityFrameworkCore; | ||
using Microsoft.EntityFrameworkCore.Metadata.Builders; | ||
using Product.Domain.Aggregates.Category.AggregateRoot; | ||
|
||
namespace Product.Infrastructure.Data.EntitytypeConfigurations.Category; | ||
|
||
public class CategoryConfiguration : IEntityTypeConfiguration<CategoryModel> | ||
{ | ||
public void Configure(EntityTypeBuilder<CategoryModel> builder) | ||
{ | ||
builder.HasKey(c => c.Id); | ||
|
||
builder.Property(c => c.Id) | ||
.IsRequired() | ||
.ValueGeneratedOnAdd(); | ||
|
||
builder.Property(c => c.Title) | ||
.IsRequired() | ||
.HasMaxLength(250); | ||
|
||
builder.HasOne(c => c.SubCategory) | ||
.WithMany() | ||
.HasForeignKey(c => c.SubCategoryId); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
....Infrastructure/Data/EntitytypeConfigurations/ChangeHistory/ChangeHistoryConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using Microsoft.EntityFrameworkCore; | ||
using Microsoft.EntityFrameworkCore.Metadata.Builders; | ||
|
||
namespace Product.Infrastructure.Data.EntitytypeConfigurations.ChangeHistory; | ||
|
||
public class ChangeLogConfiguration : IEntityTypeConfiguration<Domain.Aggregates.Shared.ChangeHistory.AggregateRoot.ChangeHistory> | ||
{ | ||
public void Configure(EntityTypeBuilder<Domain.Aggregates.Shared.ChangeHistory.AggregateRoot.ChangeHistory> builder) | ||
{ | ||
builder.HasKey(b => b.Id); | ||
builder.Property(b => b.RelatedEntityType) | ||
.HasMaxLength(150); | ||
} | ||
} | ||
|
20 changes: 20 additions & 0 deletions
20
....Infrastructure/Data/EntitytypeConfigurations/OutboxMessage/OutBoxMessageConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using Microsoft.EntityFrameworkCore; | ||
using Microsoft.EntityFrameworkCore.Metadata.Builders; | ||
using Product.Domain.Aggregates.Shared.OutboxMessage.AggregateRoot; | ||
|
||
namespace Product.Infrastructure.Data.EntitytypeConfigurations.OutboxMessage; | ||
|
||
public class OutBoxMessageConfiguration : IEntityTypeConfiguration<OutBoxMessage> | ||
{ | ||
public void Configure(EntityTypeBuilder<OutBoxMessage> builder) | ||
{ | ||
builder.HasKey(b => b.Id); | ||
|
||
builder.Property(b => b.Type) | ||
.IsRequired() | ||
.HasMaxLength(150); | ||
|
||
builder.Property(b => b.Content) | ||
.IsRequired(); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
Src/Product.Infrastructure/Data/EntitytypeConfigurations/Product/ProductConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using Microsoft.EntityFrameworkCore; | ||
using Microsoft.EntityFrameworkCore.Metadata.Builders; | ||
using Product.Domain.Aggregates.Category.AggregateRoot; | ||
using Product.Domain.Aggregates.Product.AggregateRoot; | ||
|
||
namespace Product.Infrastructure.Data.EntitytypeConfigurations.Product; | ||
|
||
public class ProductConfiguration : IEntityTypeConfiguration<ProductModel> | ||
{ | ||
public void Configure(EntityTypeBuilder<ProductModel> builder) | ||
{ | ||
builder.HasKey(p => p.Id); | ||
|
||
builder.Property(p => p.Id) | ||
.IsRequired() | ||
.ValueGeneratedOnAdd(); | ||
|
||
builder.Property(p => p.Title) | ||
.IsRequired() | ||
.HasMaxLength(250); | ||
|
||
builder.Property(p => p.SubTitle) | ||
.HasMaxLength(500); | ||
|
||
builder.OwnsOne(p => p.Price); | ||
|
||
builder.HasOne(typeof(CategoryModel)) | ||
.WithMany(); | ||
|
||
builder.HasMany(p => p.ProductComments) | ||
.WithOne(); | ||
} | ||
} |