Reputation: 35
Please advise on the following:
Context:
I have a windows service, with a service and data layer. Now my service needs to watch a folder for files and then if there are files matching a particular regex, it should load the files into the database and move the file to a 'Complete' folder.
Question:
What code should go in the Windows Service ... and what code should go into the Service Layer. My initials thoughts was to do all the loading of the file in the Service Layer while putting all the file watching and file moving capabalities in the Windows Service.
Please advise . . . Any help would be really appreciated.
Thanks!
Upvotes: 1
Views: 1125
Reputation: 71
Here is my suggestion:
Service layer:
watching for file
read file content
submit data to data layer
moving file to complete folder
Data layer:
verify data
store data
This is the simplest case (remember KISS).
If you need the logic for processing the file elsewhere you can add a third domain service layer.
Service layer:
watch for file
invoke domain service layer
Domain service layer:
read file content
submit data to data layer
move file to complete folder
Data layer:
verify data
store data
Upvotes: 2