Hello , We have different aggregate roots , they have a relation over Id property like below :
created migration with foreign key:

Like you saw in the pictures , even we try NotMapped attribute , still migration is creating foreign key automagically :) Depends on your framework suggestions and DDD , we don't want to generate foreign key between aggregate roots , instead we keep them seperately, we just want to saw ProjectId column inside Phase table not foreign key relation . But we can not do that right know it's always creating itself , we can't understand the situation.
Below example is from an outside-native ef core in a console application, when we don't use abp-wrapped ef core, they can prevent the generation of foreign key , if we ignore the navigation property , they don't create the foreign key. We're expecting the same approach basically.
What can we do about this situation ? Thank you
- ABP Framework version: v5.3.3
- UI type: MVC
- DB provider: EF Core
- **Tiered (MVC) : yes
4 Answer(s)
-
0
Hello , Anyone checked this issue ? Just a reminder :)
Thank you.
-
0
Can you share the Fluent API configuration under
onModelCreatingfor thePhaseentity?public class Project : AuditedAggregateRoot<Guid>, IMultiTenant { public Guid? TenantId { get; protected set; } public string Name { get; protected set; } public string Description { get; protected set; } public Guid BaseModelId { get; protected set; } }public class Phase : AuditedAggregateRoot<Guid>, IMultiTenant { public Guid? TenantId { get; protected set; } public Guid ProjectId { get; protected set; } public string Name { get; protected set; } public string Description { get; protected set; } }Only added DbSets and no fluent API configuration:
Although, you don't need to implement IHasExtraPropertiesfor the AggregateRoot since it already implements it. -
0
-
0
Since it is auto-generated by the EfCore, either
Projecthas navigation forPhaseor your owned entities have some relation with theProjectentity.This is not related to ABP but the EfCore itself. If you can share a public repository with the same problem, I can check. Otherwise, there seems no problem with the screenshot.



