Reputation: 768
I haw an aggregate in my domain that have some Guid
secondary keys.I want to get more info about these keys from another domains via RESTfull.
public class ProductAggregate
{
public Guid Id { get; set; }
public Guid UserId { get; set; }
public Guid AgencyId { get; set; }
public string AgencyTitle { get; set; }
}
In above code the AgencyTitle
not exists in current domain and I want to get it from another live service via Restfull and send aggregated object to the client.
Is it a acceptable way?
Upvotes: 0
Views: 710
Reputation: 2369
It sounds like you are talking about a read model that you present to a user rather than an aggregate.
There are various ways you can handle this:
Local Caching
Keep an in-memory cache locally in your service that maps between AgencyId and AgencyTitle - this can either be through:
Denormalising the data
You could duplicate the data by saving the AgencyTitle alongside the AgencyId. This way you have no call to an external service. The tradeoff is you need to consider how often the AgencyTitle is likely to change, and how you handle that change.
Reporting "domain"
You could have a completely separate service that listens for data from other services and maintains view models for UIs. This would keep your other services ignorant of other service's concerns. When using an event-driven system, you'd be listening for events form other services that allow you to build a view model for the UI
Upvotes: 5