2.4 KiB
2.4 KiB
applyTo
| applyTo |
|---|
| Fuchs_DataService/** |
Fuchs_DataService Instructions
Overview
Fuchs_DataService is a .NET 10 Windows Service (via Topshelf) that synchronises MFR entity data into the Fuchs SQL database on a configurable schedule.
Key Classes
| Class | Role |
|---|---|
FdsMainModule |
Entry point — builds LoggerFactory, creates FdsService, runs Topshelf |
FdsService |
Topshelf ServiceControl — owns PeriodicHostedService lifecycle |
PeriodicHostedService |
Runs one or more PeriodicJobDefinition jobs independently |
FdsMfr : IFdsMfr |
Singleton business logic — registered via DI constructor injection |
FdsMfrClient |
Wraps MFRClient + SQL write logic; instantiated per-use inside FdsMfr |
Archive (FdsZip) |
SevenZip wrapper; created per-use, accepts optional ILogger<Archive> |
FdsConfig |
Static config accessor — reads from appsettings.json under Fds: key |
FdsShared |
Static SQL/stream helpers — use FdsDebug.DebugLog for errors in static methods |
FdsDebug |
Legacy static logger — only for use in static helper methods |
FdsLoggerProvider |
Custom ILoggerProvider: Debug output + file + prepared DB logging |
Dependency Injection
FdsMfr is the main business singleton. It receives:
ILogger<FdsMfr>— for its own loggingILoggerFactory— to create loggers forFdsMfrClientandArchiveit instantiates
// FdsService constructor
var mfr = new FdsMfr(loggerFactory.CreateLogger<FdsMfr>(), loggerFactory);
Configuration (appsettings.json)
{
"ConnectionStrings": {
"fuchs_fds_ConnectionString": "...",
"fuchs_ConnectionString": "..."
},
"Fds": {
"ExecutionFrequency_Minutes": 15,
"DebugDetails": false,
"MFR_UserName": "...",
"MFR_Password": "...",
"MFR_host": "https://..."
}
}
Rules
- Do not use
System.Configuration.ConfigurationManager— always useFdsConfig/IConfiguration. - Do not use
OCMSorOCMS_sharp. - Use
FdsSqlOptionsfor all SQL calls (getSQLDatatable_async,getSQLDataSet_async,setSQLValue_async). - Classes that run async work must use
async/await— never.Wait()or.Resultin new code. - Add new periodic jobs as
PeriodicJobDefinitionentries inFdsService— seeperiodic_service.instructions.md. - Logging: see
logging.instructions.md.