For every table in your Analysis you need 2 classes a record class (a single record) and a Manager class (which manages the actual file access and hold a collection of records). Today we are going to talk about creating the Manager Class, which is relatively painless thanks to a couple of code bricks we have created, which you can download here. You can also follow this guide to install them.
For this example we are going to create a manager for the Company table. The first thing we do is create a new Server Class called CompanyManagerClass (or CompanyManager or whatever naming convention works for you).
Which gives us a blank class that looks like this
Now we simply type FMDin the declaration area and since that is the shortcut to the File Manager Definition Code brick it pops up as a select we can take
When we do it shows us the code and prompts use for the FileName, notice as we type the code reflects the changes
And when we press OK, it inserts the code into our class
Now we move down to the constructor area and type FMC and repeat the process
If you follow our naming convention, Every Table has a primary key named with the TableName followed by ID then you are good, if not you will need to tweak Line 3 as needed or better yet modify your code brick as needed.
That’s all there is to creating the basic manager class, there is a lot of virtual methods that we can override many of which are discussed in other post so be sure to checkout the entire collection of post covering the File Manager classes