In this application that I am developing, the domain revolves around, say, electrical appliances. There are several specialized versions of this object. Applications can be submitted to the application, and this comes from web services using data transfer objects.
While this works fine, now I'm looking to import devices from several text file formats. Consider this workflow:
- The directory watcher service sees that a new device file has been added.
- The service uses the application service from my application to send the devices described in the file
Now the application service can have a method with the following name and signature: ApplianceService.Register(string fileContents) . I think that the directory browsing service will use this service method and pass all the contents of the file to it. Then the application service will coordinate the parsing. Parsing the contents of a file and converting it into objects of complete hardware involves several steps. Now, my question is:
Question: Is this correct, or should the parsing logic live in the directory observer service? Each type of file format is part of the domain, but again, it is not. After files are analyzed in an entity from any format, the entity will never know that it was once represented using this format. If the parsing logic should live in the observer service, I will transfer the new devices to the registration service as data transfer objects.
I suppose I'm worried about how the device should be presented before it enters my application (using the application layer as an entry point). When sending devices from web services, I pass a sequence of device data transfer objects. This is different from the fact that you make a potentially strangely formatted file and parse it into a data transfer object, since the mapping from a web service request to a data transfer object is pretty straightforward, and not so complicated.
Any thoughts on this are very welcome.
Anders
source share