This pull request improves the seeding logic for default metadata API sources in Program.cs by making the process more robust and informative. The changes ensure that default sources are only added when necessary, provide clearer logging, and handle errors more explicitly.
Improvements to metadata API source seeding:
- Checks for existing metadata API sources (
Audimeta,Audnexus) before attempting to add defaults, preventing duplicate entries and unnecessary database writes. - Adds detailed logging to report the number and names of existing sources, and logs when sources are added or skipped. [1] [2] [3]
- Introduces a
needsChangesflag to track if new sources were added, and only callsSaveChanges()when needed, logging the number of records inserted.
Error handling improvements:
- Changes error logging from
LogWarningtoLogErrorand clarifies the impact of a seeding failure on metadata functionality.
Automated canary build