I am traditionally a SQL guy. I have a ton of C # experience under my belt, but all of them are usually tools or customization projects.
Now I am entrusted with writing an application that does the following ...
- Runs as a windows service
- Clock for files, and when they arrive, loads them into DB
- DB monitoring for recently uploaded files
- Do complex parsing of these files (including aggregating db records)
- Additional interfaces required (website for parsed query data, etc.)
- It is necessary to support several types of files, it is necessary to support several parsers.
So this is my first foray into IoC, and I'm trying to get things right. I use Autofac and quite agree with the concepts. My problem is to understand the root of the composition when it is ok to pass the container, which I replace with my traditional concept of "factory". My application has an L2S structure and a common repository interface. I use the Autofac module to register specific types. I have a registrar and I also use a module to register specific types. In my test console application (which will be replaced by the Windows service host) I create a container and register log and dal modules, etc. Then I can enable the file browsing classes using the constructor installation to enter the registrar and repository. I also add a queue object (in my case, a queue with memory backup, but it can be a db queue), on which new files are installed (manufacturer). At the other end of the line, I need a consumer. Thus, depending on the type of file that is being called, I need to use a different loader class. I would historically use the factory pattern to return the corresponding concrete class. Since the registrar and the corresponding repository must be installed for the loader class, I donβt see how to create an instance of the corresponding loader class to process the element that leaves the queue without assigning an IoC container reference to my factory class. I know that I can implement various element handlers into my consumer class, but I say that I had 50 file types or 100, which is impractical.
After I figured out how to do this, I need to do something similar to keep track of new parsing work (entries in the db table) and process them, but I assume that it will follow the similar pattern above.
Any tips? I am so far away (a short distance) from binning my C # and go to SSIS to load a file, and then crack some kind of nasty parser code in SSIS. Please help a C # student.
trickbooter
source share