Created
October 19, 2024 14:47
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
internal class Category:Entity | |
{ | |
public string CategoryName { get; set; } | |
public string Description { get; set; } | |
public byte[] Picture { get; set; } | |
public IList<Product> Products { get; set; } | |
} |
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
internal class CategoryMap : IEntityTypeConfiguration<Category> | |
{ | |
public void Configure(EntityTypeBuilder<Category> builder) | |
{ | |
builder.ToTable("Categories") | |
.Property(x => x.Id).HasColumnName("CategoryID"); | |
} | |
} |
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
public record CategoryReadModel | |
{ | |
internal CategoryReadModel() | |
{ | |
} | |
public CategoryReadModel(int id, string categoryName, string description) | |
=> (Id, CategoryName, Description) = (id, categoryName, description); | |
public int Id { get; init; } | |
public string CategoryName { get; init; } | |
public string Description { get; init; } | |
} |
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
internal class CategoryReadModeldMap : IEntityTypeConfiguration<CategoryReadModel> | |
{ | |
public void Configure(EntityTypeBuilder<CategoryReadModel> builder) | |
{ | |
builder.ToTable("Categories") | |
.Property(x => x.Id).HasColumnName("CategoryID"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment