We have an externally-owned SQL server with data that needs to be in our periodically ported into our team-owned (SQL) server.
The external and internal server share the same domain concepts but exist in very distinct forms. Transforming the object from its external form into our own domain form is a complicated process.
currently this is done like so:
- Adapter queries External Db, use Automapper to map to DTO (Adapter lives in infra layer)
- Adapter returns DTO to application layer (DTO defined in the app layer)
- Factory constructs domain object from DTO and factory loads related domain aggregates to set navigation IDs + other properties (Factory lives in app layer)
Is it proper to consider the work here by the factory as really building a new object since it's really hydrating an object from an external source, and we add further (required) decorations? The Entity ID stays the same as its transformed.
However calling this a repository also feels wrong as there is more work than just a simple hydration from a single DB?
I'm still new to DDD so any and all inputs are appreciated!