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
Model relationship with ApplicationUser #896
Comments
Using DDD principles you shouldn't link Aggregate Roots. The Order and ApplicationUser are aggregate roots. As a rule of thumb an Aggregate should only reference other aggregates by their Id. That means you shouldn't add navigation properties to other aggregates (this prevents different aggregates manipulating each other and leaking business logic to each other). You should explicitly query the ApplicationUser by the UserId if you need to get User information If you have OrderLine class then this would be an entity class and you could therefore attached to the Order class i.e.
Hope that helps :-) |
Could you please help me create a Order class which belongs to User?
I tried as below but the ApplicationUser is part of Infrastructure project which should not be imported in Domain Project as per architecture.
`
public class Order : AuditableEntity, IAggregateRoot
{
....
public Guid UserId{ get; set; }
public virtual ApplicationUser User { get; set; }
}
`
I am missing something or doing it wrong way?
The text was updated successfully, but these errors were encountered: