fullstackhero / dotnet-starter-kit

Production Grade Cloud-Ready .NET 8 Starter Kit (Web API + Blazor Client) with Multitenancy Support, and Clean/Modular Architecture that saves roughly 200+ Development Hours! All Batteries Included.
https://fullstackhero.net/dotnet-webapi-boilerplate/
MIT License
5.2k stars 1.56k forks source link

One model - two table !? #1042

Open Mike6x opened 2 weeks ago

Mike6x commented 2 weeks ago

I Have two module in two project with two Database shema like Todos Module :

When do migration, EF created two Dimensions table: One for Quiz Quiz Project, one for Setting Project !!

How to work around this issue , because I only want all porjects use same table Dimension in Setting Module ?

Belows are codes ...

` namespace FSH.Starter.WebApi.Elearning.Domain;

public class Quiz : AuditableEntity, IAggregateRoot { public int Order { get; private set; } public string Code { get; private set; } public string Name { get; private set; } public Guid QuizTypeId { get; private set; } public virtual Dimension QuizType { get; private set; } = default!; public Guid QuizTopicId { get; private set; } public virtual Dimension QuizTopic { get; private set; } = default!; public Guid QuizModeId { get; private set; } public virtual Dimension QuizMode { get; private set; } = default!; }

namespace FSH.Starter.WebApi.Setting.Domain;

public class Dimension : AuditableEntity, IAggregateRoot { public int Order { get; private set; } public string Code { get; private set; } public string Name { get; private set; } public string? Description { get; private set; } } ` ' namespace FSH.Framework.Infrastructure.Persistence; public static class SchemaNames { public const string Todo = "todo"; public const string Catalog = "catalog"; public const string Tenant = "tenant"; public const string Setting = "setting"; public const string Elearning = "elearning"; }

'

image
jacekmichalski commented 6 days ago

I'm also interested in figuring out how to different modules should communicate. E.g. there is product catalog module. Next I want to add e.g. competitor offers module (to track competitor prices). So one product has many offers. How to communicate between modules? @iammukeshm do you have any examples? Thanks in advance

arisng commented 5 days ago

I guess this article will point you in the appropriate direction for your problem. Modeling Navigation Properties Between Aggregates or Modules https://ardalis.com/navigation-properties-between-aggregates-modules/