|
| 1 | +# Copilot Instructions for SQL Compact Query Analyzer |
| 2 | + |
| 3 | +## Project Overview |
| 4 | +SQL Compact Query Analyzer is a Windows desktop application for querying and managing SQL Server Compact Edition (SQLCE) databases. It provides a GUI for creating databases, executing queries, viewing data, and managing database schema. |
| 5 | + |
| 6 | +## Technology Stack |
| 7 | +- **Language**: C# |
| 8 | +- **Framework**: .NET Framework 4.7.2 |
| 9 | +- **UI Framework**: WPF (Windows Presentation Foundation) |
| 10 | +- **Build System**: Cake Build (build.cake), MSBuild |
| 11 | +- **CI/CD**: GitHub Actions (`.github/workflows/build.yml`) |
| 12 | +- **Packaging**: Inno Setup for Windows installers, Chocolatey for package distribution |
| 13 | +- **Target Platforms**: Windows (x86 and x64) |
| 14 | + |
| 15 | +## Project Structure |
| 16 | +- **Source/Editor**: Main WPF application with MVVM pattern |
| 17 | + - `Controls/`: Custom WPF controls |
| 18 | + - `View/`: XAML views |
| 19 | + - `ViewModel/`: View models for MVVM pattern |
| 20 | + - `Misc/`: Utility and helper classes |
| 21 | +- **Source/SqlCeDatabase**: Core database abstraction library (base interfaces) |
| 22 | +- **Source/SqlCeDatabase31**: SQLCE 3.1 specific implementation |
| 23 | +- **Source/SqlCeDatabase35**: SQLCE 3.5 specific implementation |
| 24 | +- **Source/SqlCeDatabase40**: SQLCE 4.0 specific implementation |
| 25 | +- **Source/TSqlParser**: T-SQL parsing utilities |
| 26 | +- **Dependencies**: External dependencies and tools |
| 27 | +- **Screenshots**: Application screenshots for documentation |
| 28 | + |
| 29 | +## Build & Development |
| 30 | + |
| 31 | +### Building the Project |
| 32 | +```powershell |
| 33 | +# Navigate to Source directory |
| 34 | +cd Source |
| 35 | +
|
| 36 | +# Run Cake build script (restores NuGet packages, builds solution, creates installers) |
| 37 | +./build.ps1 |
| 38 | +``` |
| 39 | + |
| 40 | +The build process: |
| 41 | +1. Cleans previous build artifacts |
| 42 | +2. Restores NuGet packages |
| 43 | +3. Builds solution for x86 and x64 platforms |
| 44 | +4. Creates Windows installers using Inno Setup |
| 45 | +5. Generates Chocolatey package |
| 46 | + |
| 47 | +### Build Outputs |
| 48 | +- **Binaries**: `Source/Binaries/Release/{x86|x64}/` |
| 49 | +- **Installers**: `Source/Artifacts/SQLCEQueryAnalyzer-Setup-{x86|x64}.exe` |
| 50 | +- **Artifacts**: `Source/Artifacts/` |
| 51 | + |
| 52 | +### Running the Application |
| 53 | +The main executable is built as `QueryAnalyzer.exe` in the binaries directory. It requires .NET Framework 4.0 or higher. |
| 54 | + |
| 55 | +## Coding Standards |
| 56 | + |
| 57 | +### Code Style |
| 58 | +- Use standard C# naming conventions (PascalCase for classes/methods, camelCase for parameters/locals) |
| 59 | +- Use meaningful variable and method names |
| 60 | +- Keep methods focused and concise |
| 61 | +- Use interfaces for abstraction (e.g., `ISqlCeDatabase`) |
| 62 | + |
| 63 | +### Namespaces |
| 64 | +- Root namespace: `ChristianHelle.DatabaseTools.SqlCe` |
| 65 | +- Editor/UI namespace: `ChristianHelle.DatabaseTools.SqlCe.QueryAnalyzer` |
| 66 | + |
| 67 | +### MVVM Pattern |
| 68 | +The application follows the MVVM (Model-View-ViewModel) pattern: |
| 69 | +- **Models**: Database entities and business logic in SqlCeDatabase projects |
| 70 | +- **Views**: XAML files in `Source/Editor/View/` |
| 71 | +- **ViewModels**: View model classes in `Source/Editor/ViewModel/` |
| 72 | + |
| 73 | +### Database Version Support |
| 74 | +The project supports multiple SQLCE versions (3.0, 3.1, 3.5, 4.0) through separate assemblies. Each version has its own project that implements the same interfaces. |
| 75 | + |
| 76 | +## Important Notes |
| 77 | + |
| 78 | +### No Unit Tests |
| 79 | +This repository does not currently have unit tests. When making changes: |
| 80 | +- Manually test functionality where possible |
| 81 | +- Consider the impact on all supported SQLCE versions |
| 82 | +- Test both x86 and x64 builds if changes affect platform-specific code |
| 83 | + |
| 84 | +### Version Management |
| 85 | +- Assembly versions are updated during CI/CD via PowerShell scripts |
| 86 | +- Version format: `1.3.4.<build_number>` |
| 87 | +- Versions are set in `AssemblyInfo.cs` files and Inno Setup scripts |
| 88 | + |
| 89 | +### Dependencies |
| 90 | +- SQL Server Compact Edition runtime libraries are required dependencies |
| 91 | +- NuGet packages are restored automatically during build |
| 92 | +- External tools (like Inno Setup) are in the `Dependencies` directory |
| 93 | + |
| 94 | +## Common Tasks |
| 95 | + |
| 96 | +### Adding a New Feature |
| 97 | +1. Identify which project(s) need changes (Editor for UI, SqlCeDatabase* for database logic) |
| 98 | +2. Follow MVVM pattern for UI features (create View, ViewModel, wire up in App.xaml.cs) |
| 99 | +3. Update all SQLCE version projects if changing database interfaces |
| 100 | +4. Update documentation (README.md) if user-visible changes |
| 101 | +5. Build and test manually with Cake build script |
| 102 | + |
| 103 | +### Modifying Database Operations |
| 104 | +1. Update the `ISqlCeDatabase` interface if adding new operations |
| 105 | +2. Implement in all version-specific projects (SqlCeDatabase31, 35, 40) |
| 106 | +3. Update the Editor project to expose new functionality in the UI |
| 107 | +4. Consider backward compatibility with older SQLCE versions |
| 108 | + |
| 109 | +### UI Changes |
| 110 | +1. WPF XAML files are in `Source/Editor/View/` |
| 111 | +2. Follow existing XAML structure and naming conventions |
| 112 | +3. Use data binding to ViewModels |
| 113 | +4. Custom controls are in `Source/Editor/Controls/` |
| 114 | + |
| 115 | +### Build Configuration Changes |
| 116 | +- Modify `Source/build.cake` for build process changes |
| 117 | +- Update `.github/workflows/build.yml` for CI/CD changes |
| 118 | +- Platform configurations: x86, x64 (no AnyCPU due to SQLCE dependencies) |
| 119 | + |
| 120 | +## File Associations |
| 121 | +- `.sdf` files: SQL Server Compact Edition database files |
| 122 | +- `.iss` files: Inno Setup installer scripts (`Setup-x86.iss`, `Setup-x64.iss`) |
| 123 | +- `.cake` files: Cake build scripts |
| 124 | +- `.nuspec` files: Chocolatey package specifications |
| 125 | + |
| 126 | +## External Resources |
| 127 | +- Project repository: https://github.com/christianhelle/sqlcequery |
| 128 | +- Author's blog: https://christianhelle.com |
| 129 | +- Releases: https://github.com/christianhelle/sqlcequery/releases |
| 130 | + |
| 131 | +## Making Changes |
| 132 | +When contributing or making changes: |
| 133 | +1. Keep changes minimal and focused |
| 134 | +2. Follow existing code patterns and conventions |
| 135 | +3. Ensure changes work on both x86 and x64 platforms |
| 136 | +4. Test manually since there are no automated tests |
| 137 | +5. Update README.md if adding user-visible features |
| 138 | +6. Consider impact on all supported SQLCE versions (3.0, 3.1, 3.5, 4.0) |
0 commit comments