How user4000/tj-ms-sql-server-scripter works
Project type and purpose
• This is a Windows desktop application (built with .NET and Telerik WinForms) whose sole purpose is to automate “scripting” of MS SQL Server database objects on a schedule.
• It consists of two subprojects in one solution:
– ProjectStandard: A common utility/standard library.
– TJMsSqlScripter: The actual scheduler and script generator.
File structure
• ProjectStandard:
– Extensions, Grid, Models, ModelsFactory, ReturnCode, Security, Tools – these form a reusable utility library (logging, data models, grid helpers, error codes, security stubs, async tools, etc.).
– Provides interfaces (ILoginFormManager, ISqlConnectionFactory) and default implementations.
• TJMsSqlScripter:
– UI Layer: RadFormAdmin (Telerik WinForms).
– Core: TTJobManager, TTJobFactory, TTManager, TTScriptMaker, TTConnection.
– Data Models: TTDay, TTPeriod, TTSession, TTProjectSettings.
– Entry point: Program.cs (bootstraps UI or scheduling host).
README insights
• “Tool for scripting objects of MS SQL Server database.”
• “Designed for permanent work on a schedule” – implies integration with Windows Task Scheduler (or an internal timer).
a. Components
1) User Interface Layer
– RadFormAdmin (admin settings)
– (Optionally) RadFormLogin if used or inherited from ProjectStandard
2) Core Scheduler/Orchestrator
– Program.cs (host)
– TTManager & TTManagerFactory (initialization, DI)
– TTJobManager & TTJobFactory (job creation, lifecycle)
– TTSession (holds context, credentials)
3) Script Generation Engine
– TTScriptMaker (builds SQL scripts for database objects)
4) Data Access
– TTConnection / ISqlConnectionFactory (connects to MS SQL Server via ADO.NET)
5) Standard Library
– ProjectStandard (shared utilities, models, error handling, extensions)
6) External Services
– MS SQL Server (the database server you’re scripting)
– Windows Task Scheduler or internal timer component
– File system (output scripts), Logging sink (text files or console)
b. Relationships & data flows
• On schedule trigger → Program host starts a session → TTJobManager picks up configured jobs → for each job:
– JobManager uses TTConnection to connect → TTScriptMaker queries sys tables → generates .sql files → writes to disk.
• Admin UI calls into Manager layer to create/update jobs & schedule settings (persisted in TTProjectSettings).
• The Standard Library underpins all layers (interfaces, models, error codes).
c. Architectural patterns & principles
• Layered architecture: UI → Orchestration → Data Access → External.
• Factory pattern: TTManagerFactory, TTJobFactory, TTReturnCodeFactory.
• Dependency inversion: interfaces (ISqlConnectionFactory, ILoginFormManager) with concrete in ProjectStandard.
• Separation of concerns: UI vs scheduling vs script generation vs data models.
d. Key technologies/frameworks
• .NET Framework (C#)
• Telerik WinForms (RadForm controls)
• ADO.NET or SqlClient (TTConnection)
• ProjectStandard custom library
• Windows Task Scheduler or internal timer loop