Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

One model - two table !? #1042

Open
Mike6x opened this issue Oct 15, 2024 · 2 comments
Open

One model - two table !? #1042

Mike6x opened this issue Oct 15, 2024 · 2 comments

Comments

@Mike6x
Copy link

Mike6x commented Oct 15, 2024

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

  • Setting Module with Dimension model => to save some pickup value ...., then other project can use it.
  • Elearing Module with Quiz model
  • Quiz and Dimension have relationship one => Many

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
Copy link
Contributor

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
Copy link

arisng commented Oct 25, 2024

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/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants