Files are loaded via the fnLoader function. The project/solution with this file is called NSWERS.Functions.Load.
Steps to add/update a loading routine:
- Update or add a model in NSWERS.packages. The file(s) should be in the NSWERS.Common.Models\ResearchDB folder. Each spec version needs its own model, but they are generally kept in the same base file. Once updated, commit and PR this change so the packages will build.
- Update the NuGet packages in the NSWERS.Functions.Load Model after the packages pipeline is finished running.
- In the DTO\ResearchRecord.cs file, add or update the new file or column. Columns are retrieved by “field number” – this is the fN variable.
- These are collected in methods by minor spec version numbers. For example, “MakeRecord_1_2”, “MakeRecord_1_3”, etc
- If a new minor spec is released, a new method needs to be created that follows this pattern. ONLY specs that are new and/or changed for this version need to be added to this method.
- Additionally, a call to this new method will need to be added near the top of the MakeRecord method (same file). This is done to allow the load process to fail back to previous versions.
- For example, if the new version is 1.4.x, this code would be added:
versionsTocheck.Add("1.4");if (record is null && versionsTocheck.Contains(identifier)) {
record = MakeRecord_1_4(r, partnertype, filetype, filename);}
- For example, if the new version is 1.4.x, this code would be added:
- If this is for an entirely new file or new spec version of a file, edit the insert_researchrecord method to reference the correct model. A new delete and insert method will also need to be created specific to the model name.
- If updating and existing routine, in the Accessors\ResearchDBLoad, edit the insert SQL to accommodate the changes. The method should be called something like insert_[type]_[filename].
Leave a Reply