OzzCodeGen is a pluggable code generator library with a WPF UI, OzzCodeGen.Wpf. OzzLocalization is a companion library (with its own UI OzzLocalization.Wpf) used to create and manage translated strings that OzzCodeGen can consume during code generation.
OzzCodeGen:2.3.0OzzCodeGen.Wpf:2.3.0OzzLocalization:2.1.6OzzLocalization.Wpf:2.1.6
See CHANGELOG.md for release history.
- Added new
Wpf_Mvvm_View_ViewModel_Generator(WpfMvvmCodeEngine) to generate WPF Create/Edit Views, ViewModels, Commands, and per-entity Lookup Services. - Added
CSharpLookupServiceTemplate.ttfor auto-generating lookup service interfaces and implementations with design-time/test stubs. - Added detailed XML documentation generation for generated lookup service interfaces and classes.
- Refactored lookup-service template flow to use explicit
TemplateTypebranches. - Lookup-service design-time classes are now generated as
partial(notsealed) for extensibility. - Refined lookup-service runtime namespace imports so usings are emitted only when needed.
- Improved lookup-service overwrite behavior to respect per-entity generation flags.
- Lookup-service interface and design-time class generation now always runs for lookup services.
- Added
RepositoryInstanceNametoBaseMvvmEntitySettingfor consistent DI naming in generated services. - Added MVVM infrastructure generation support (
InfrastructureFolder) for shared base/contracts output, intentionally platform-agnostic for future reuse (e.g., MAUI). - Refactored infra/runtime folder handling: when
InfrastructureFolderis empty, base classes/interfaces render to target ViewModels/Services folders; when set, they render toInfrastructureFolder/ViewModelsandInfrastructureFolder/Services. - Made
TargetInfrastructureDirectoryvirtual inBaseAppInfraCodeEngineand centralized its path-selection logic. - Added
GetNamespace()to templates for correct infrastructure/runtime namespace selection. - Updated
DefaultUsingNamespaceList()to include contracts namespace when infrastructure output is separated. - Adjusted
WpfMvvmCodeEngineto write infrastructure/runtime files into the correct output directories. - Added
GetFolderToNamespacehelper and cleaned up usings inCsClassBase.part.cs. - Added
RenderBaseViewModelsto generate all base ViewModel classes:AbstractViewModel,AbstractDataErrorInfoVM,AbstractCreateEditVM, andAbstractCollectionVM. - Added
CSharpWpfBaseVmTemplate.ttand generated.cs/.part.csfiles for base ViewModel andIIsDirtyinterface generation. - Added
DefaultValue,FormatDefaultValue(),IsReadOnlyInCreate/IsReadOnlyInEdit, andValueConstraintto MVVM entity/property settings. - Added
GenerateLookupServicetoBaseMvvmEntitySettingfor per-entity lookup-service generation control. - Added
ServiceNamespaceNameandServiceFoldertoBaseMvvmCodeEnginefor service output namespace/folder configuration. - Added namespace/subfolder helpers and repository name support to MVVM engine settings and
WpfMvvmEngineUI. - Extended
BaseCSharpWpfMvvmTemplatewithisInterfaceparameter support for flexible interface/implementation generation. - Rewrote WPF ViewModel T4 template with improved default-value and read-only logic; removed old
.cs-based templates. - Changed
IsForeignKeyfrom a method to a property; refactoredBasePropertySettingto use expression-bodied type-check properties. - Improved visual consistency across WPF engine UIs by standardizing button/DataGrid backgrounds, reducing control heights, and simplifying folder labels.
- Updated
AbstractEngineUIto shorten "ViewModel" column headers to "VM". - Enhanced
WpfMvvmEngineUIwith per-entity View/ViewModel toggles and improved property grid layout. - Updated DataGrid hidden columns and widths in WPF MVVM and SQLite repository UIs.
- Updated
.csprojto include the new WPF base ViewModel and lookup service templates and generated files. - Default namespace logic for infrastructure/contracts now consistently uses
Project.NamespaceName. - Minor parameter refactoring in
CSharpWpfViewModelTemplatefor consistency and clarity. - Fixed infrastructure directory resolution, infra/runtime namespace separation edge cases, and variable naming issues.
- Bumped
OzzCodeGenandOzzCodeGen.Wpfto2.3.0.
- Replaced
GetNullableDecimalwithGetDecimalFromIntegerandGetDecimalFromTexthelpers inCSharpSqliteExtensionsTemplatefor clearer decimal mapping. - Refactored
GetMappingExpressionto use new decimal helpers and accept aneedsCommaparameter for improved formatting. - Updated SQLite repository templates to use improved mapping and formatting logic throughout.
- No business logic changes; generated code is clearer and more robust for decimal handling.
- Bumped
OzzCodeGenandOzzCodeGen.Wpfto2.2.23.
- Added paged query method generation (
GetPagedAsync) to C# SQLite repository code generation with per-entity query parameters. - Added per-entity WPF UI toggle for paged query generation (
GeneratePagedproperty). - Refactored SQLite repository templates with modular autoloading and parameter handling for improved flexibility.
- Enhanced extensibility for future search and filter features.
- Bumped
OzzCodeGenandOzzCodeGen.Wpfto2.2.22.
- Added
IsDoubleandIsFloatproperties toBasePropertySettingfor fine-grained numeric type checks. - Added
IsIntegerandIsTextproperties toStorageColumnSettingfor clearer column-type detection. - Expanded
SqliteExtensionswith overloads forDateTime,bool, integer, and string parameters (nullable and non-nullable). - Enhanced
SqliteRepositoryPropertySettingwith new column type helpers and improved documentation. - Renamed
IsTypeIntNumeric→IsTypeIntegerNumericand updated all usages for consistency. - Refactored SQLite repository templates to use new type-safe
SqliteCommandextension methods. - Improved decimal-to-integer and decimal-to-text conversion handling in generated repositories.
- Bumped
OzzCodeGenandOzzCodeGen.Wpfto2.2.21.
- Added
SqliteExtensionsfor reusable nullable and scaled decimal SQLite parameter handling in generated repositories. - Added
DecimalToIntegerScaleto SQLite repository property settings and exposed it in the WPF UI. - Added generation of a
DecimalToIntegerScalestruct for entities with decimal columns. - Replaced
AddNullableTextParameterusage in repository templates and generated code with SQLite extension methods. - Renamed
IsDecimalNumeric/IsIntNumerictoIsFractionalNumeric/IsIntegerNumericfor clearer intent. - Bumped
OzzCodeGenandOzzCodeGen.Wpfto2.2.20.
- Refactored
QueryParametersTemplateto better distinguish simple searchable properties from min/max date/numeric searchable properties. - Added
HasAnySearchCriteria()virtual/override methods for more robust and extensible generated search detection. - Added partial-method support for custom
HasAnySearchCriteria()logic extension. - Bumped
OzzCodeGenandOzzCodeGen.Wpfto2.2.19.
- Added per-entity strongly-typed
QueryParametersclass generation support viaGenerateQueryParam. - Refactored model-class templates/code to support both base and derived
QueryParametersgeneration paths. - Updated filtering inclusion control to use
IsSearchParameterfor generated SQL/LINQWHEREbehavior. - Improved naming consistency and refreshed related documentation.
- Icon set: Bootstrap Icons v1.13.1
- Source: https://icons.getbootstrap.com
- Repository: https://github.com/twbs/icons
- License: MIT
- Geometry resources are stored in
OzzCodeGen/Resources/BootstrapIcons.xaml.
- .NET 10 SDK – Download from dotnet.microsoft.com
- Visual Studio 2026 (or later) with WPF and C# workloads, or Visual Studio Code with C# extensions
- Git (optional, for cloning the repository)
OzzUtils (Shared Utilities)
↓
OzzLocalization ←→ OzzLocalization.Wpf
↓
OzzCodeGen ←→ OzzCodeGen.Wpf
├── CodeEngines (Pluggable generators)
└── Providers (Empty)
- OzzUtils: Shared utilities library (extensions, helpers) consumed by code generation and localization projects.
- OzzCodeGen: Core library with domain model (
DataModel,EntityDefinition,BaseProperty), provider abstractions (IModelProvider), and multiple code engines underOzzCodeGen/CodeEngines. - OzzCodeGen.Wpf: WPF application for creating/opening a
CodeGenProject, selecting a Model Provider, adding Code Engines, and generating artifacts. - OzzLocalization: Library that manages XML vocabularies (see
OzzLocalization/Vocabularies.cs,OzzLocalization/Vocabulary.cs). Providesvocabulary.??.xmlfiles consumed by resource-related engines. - OzzLocalization.Wpf: WPF application for editing and organizing vocabularies used by OzzCodeGen.
- OzzCodeGen.sln: Complete tooling solution containing code generation and vocabulary management (all projects listed above).
Use .NET 10 SDK. Main Windows projects target net10.0-windows10.0.19041.0.
dotnet restore OzzCodeGen.sln
dotnet build OzzCodeGen.sln -c Debug- CodeGen UI: Start
OzzCodeGen.Wpf. Create/open a project (*.OzzGen), choose a Model Provider, add engines, then generate outputs. - Localization UI: Start
OzzLocalization.Wpf. Editvocabulary.??.xmlfiles (defaultnotr) and save; engines in OzzCodeGen can use these strings.
- Visual Studio: Open
OzzCodeGen.sln, then set a WPF project as Startup (right-click project → Set as Startup Project). - VS Code: Open the workspace folder; use the C# extension for IntelliSense and debugging.
- Clone the repository:
git clone https://github.com/ozalpd/OzzCodeGen.git - Open
OzzCodeGen.slnin your IDE - Restore and build:
dotnet restore && dotnet build - Set
OzzCodeGen.WpforOzzLocalization.Wpfas Startup Project - Press F5 to run or Ctrl+F5 to run without debugging
- Create a new folder under
OzzCodeGen/CodeEngines/<YourEngineName>/. - Create a
BaseCodeEnginesubclass with:EngineIdproperty (unique identifier)ProjectTypeNamepropertyDefaultFileNamefor saving engine stateCreateEntitySetting()andOpenFile()for persistence and settings creationRefreshFromProject()to sync withCodeGenProjectGetTemplateList()for explicit template selectionUiControlproperty exposing a WPFUserControlfor UI
- Prefer engine-specific entity and property settings instead of generic
EntitySettingandPropertySettingtypes. - Add UI folder:
CodeEngines/<YourEngineName>/UI/with your control. - Register the engine in
OzzCodeGen/CodeEngines/EngineTypes.cs:- Add a new case in
GetInstance()method - Map the ID in the
OpenFile()method
- Add a new case in
- For templates, use
.tt(T4 template) +*.part.cspattern and wireDependentUponin.csproj. In-progress template scaffolds are acceptable while the engine contract is still being shaped.
- Implement
IModelProviderinterface (seeOzzCodeGen/Providers/IModelProvider.cs) - Implement
SelectSource()for source selection UI - Implement
RefreshDataModel()to return/update aDataModel - Wire provider selection in
MainWindow.xaml.csor provider dialog
- Templates are
.tt(T4) files with accompanying*.part.csfiles - Example:
CodeEngines/Localization/Templates/SingleResx.tt+SingleResx.part.cs - Regenerate manually: Right-click
.tt→ Run Custom Tool - Automatic regeneration: Preprocessed at build time via
.csprojconfiguration
- Build the solution (see Build section).
- Launch
OzzLocalization.Wpfand createvocabulary.notr.xmlunder a folder next to your project file. - Launch
OzzCodeGen.Wpfand create a new project:- Pick a Model Provider (e.g., Empty).
- Add engines via the plus button, e.g.,
Localization_Resource_Generator. - Save the project (
.OzzGen) to establishTargetSolutionDir.
- In the
Localization_Resource_GeneratorUI:- Set
TargetFolder(default$"{Project.TargetFolder}\\{Project.Name}.i18n"). - Set
VocabularyFolderto the folder containingvocabulary.??.xml(relative to the project file). - Choose
SingleResxfor a combined resource or per-entity resources. - Click Render to generate
.resxfiles underTargetSolutionDir/TargetFolder.
- Set
- Engine ID:
Localization_Resource_Generator(seeOzzCodeGen/CodeEngines/EngineTypes.cs). - Vocabulary discovery: ResxEngine loads vocabularies from
VocabularyDirresolved fromCodeGenProject.SavedFileName+VocabularyFolder(seeResxEngine.VocabularyDir). - Outputs:
- Default target folder is
$"{Project.TargetFolder}\\{Project.Name}.i18n"(seeResxEngine.GetDefaultTargetFolder). - Default combined resource base name is
SingleResxFilename = "LocalizedStrings". - Generates one
.resxper culture code for each entity or a single combined file whenSingleResxis enabled (seeResxEngine.RenderSelectedTemplate).
- Default target folder is
- Optional: Set
SaveWithVocabulariesto duplicatevocabulary.??.xmlinto the target directory on save (seeResxEngine.SaveToFile).
- SingleResx enabled:
LocalizedStrings.notr.resx,LocalizedStrings.tr.resx(default file base isSingleResxFilename→LocalizedStrings). - Per-entity resources:
CustomerString.notr.resx,OrderString.tr.resx(default base fromGetDefaultTargetFile→${entity.Name}String).
CodeGenProject.TargetPlatform controls the target .NET platform for generated code via the TargetDotNetPlatform enum (defined in OzzCodeGen/_enums.cs):
| Value | Description |
|---|---|
DotNetFramework |
Classic .NET Framework output (default for backward compatibility). |
ModernDotNet |
Modern .NET (.NET 6+) output — enables nullable reference type annotations (? suffix) and other modern conventions. |
Engines check Project.TargetPlatform to adapt generated code. For example, MetadataPropertySetting.GetTypeName() appends ? for nullable reference types only when targeting ModernDotNet. The WPF UI exposes this via a Target Platform ComboBox in the toolbar.
| Engine ID | Description | Status |
|---|---|---|
CS_Model_Class_Generator |
Generates C# model classes (primary path) using CSharpModelClassTemplate/BaseCSharpModelClassTemplate. |
✅ Active |
CS_Sqlite_Repository_Generator |
Generates C# SQLite repository classes using the CsSqliteRepository engine stack, including SqliteExtensions-based nullable/scaled decimal handling and per-property DecimalToIntegerScale support. |
✅ Active |
Wpf_Mvvm_View_ViewModel_Generator |
Generates WPF MVVM Create/Edit Views, ViewModels, and Commands; includes InfrastructureFolder output. This folder is intentionally platform-agnostic so the generated base/contracts can be reused by future engines (for example, MAUI) with minimal duplication. |
✅ Active |
Metadata_Class_Generator |
Generates metadata/validation attribute classes (legacy compatibility path). | ✅ Active |
AspNetMvc_Controller_View_Generator |
Generates ASP.NET MVC controllers and Razor views. | ✅ Active |
T-Sql_Scripts_Generator |
Generates T-SQL DDL scripts. | ✅ Active |
Sqlite_Scripts_Generator |
Generates SQLite DDL scripts. | ✅ Active |
Localization_Resource_Generator |
Generates .resx resource files from XML vocabularies. |
✅ Active |
EF_Technical_Document |
Generates technical documentation from the data model. | ✅ Active |
EF_DatabaseFirst_DataLayer |
EF Database-First data layer generation. | ❌ Removed |
ObjectiveC_Code_Generator |
Objective-C code generation. | ❌ Removed |
Android_Code_Generator |
Android/Java code generation. | ❌ Removed |
- Use
CS_Model_Class_Generatorfor new projects. It is the primary and actively evolved C# model-class generation path. - Keep
Metadata_Class_Generatorfor existing/legacy projects that already depend on metadata engine IDs/settings and serialized project compatibility. - Both engines remain loadable, but migration should be incremental:
- Create new outputs with
CS_Model_Class_Generator. - Keep
Metadata_Class_Generatorenabled for old outputs/settings until manual validation is complete. - Remove legacy engine usage only after save/load and generated output parity checks pass.
- Create new outputs with
- Engine IDs and registration: see
OzzCodeGen/CodeEngines/EngineTypes.cs. - Model-class primary stack:
OzzCodeGen/CodeEngines/CsModelClass/CSharpModelClassCodeEngine.csOzzCodeGen/CodeEngines/CsModelClass/BaseModelClassCodeEngine.csOzzCodeGen/CodeEngines/CsModelClass/Templates/CSharpModelClassTemplate.ttOzzCodeGen/CodeEngines/CsModelClass/Templates/BaseCSharpModelClassTemplate.ttOzzCodeGen/CodeEngines/CsModelClass/Templates/BaseCSharpModelClassTemplate.part.cs
- SQLite repository stack:
OzzCodeGen/CodeEngines/CsSqliteRepository/CSharpSqliteRepositoryEngine.csOzzCodeGen/CodeEngines/CsSqliteRepository/Templates/BaseCSharpSqliteRepositoryTemplate.ttOzzCodeGen/CodeEngines/CsSqliteRepository/Templates/BaseCSharpSqliteRepositoryTemplate.part.csOzzCodeGen/CodeEngines/CsSqliteRepository/Templates/CSharpSqliteBaseRepositoryTemplate.ttOzzCodeGen/CodeEngines/CsSqliteRepository/Templates/CSharpSqliteBaseRepositoryTemplate.part.csOzzCodeGen/CodeEngines/CsSqliteRepository/Templates/CSharpSqliteRepositoryTemplate.ttOzzCodeGen/CodeEngines/CsSqliteRepository/Templates/CSharpSqliteRepositoryTemplate.part.cs
- WPF MVVM stack (shared base in
Mvvm/, WPF-specific inWpfMvvm/):OzzCodeGen/CodeEngines/Mvvm/BaseMvvmCodeEngine.cs(platform-agnostic base)OzzCodeGen/CodeEngines/Mvvm/BaseMvvmEntitySetting.csOzzCodeGen/CodeEngines/Mvvm/BaseMvvmPropertySetting.csOzzCodeGen/CodeEngines/WpfMvvm/WpfMvvmCodeEngine.csOzzCodeGen/CodeEngines/WpfMvvm/Templates/WpfMvvmViewXamlTemplate.csOzzCodeGen/CodeEngines/WpfMvvm/Templates/WpfMvvmViewModelTemplate.csOzzCodeGen/CodeEngines/WpfMvvm/Templates/WpfMvvmCommandsTemplate.csOzzCodeGen/CodeEngines/WpfMvvm/Templates/MvvmBaseClassesTemplate.cs(infrastructure)OzzCodeGen/CodeEngines/WpfMvvm/Templates/MvvmContractsTemplate.cs(infrastructure)
- Metadata compatibility stack:
OzzCodeGen/CodeEngines/Metadata/MetadataCodeEngine.cs
- Project orchestration: see
OzzCodeGen/CodeGenProject.cs. - Target platform enum: see
OzzCodeGen/_enums.cs(TargetDotNetPlatform). - Data model serialization and helpers: see
OzzCodeGen/DataModel.cs. - Model provider implementation (Empty): see
OzzCodeGen/Providers/EmptyModel.cs. - Vocabulary loading/saving: see
OzzLocalization/Vocabularies.csandOzzLocalization/Vocabulary.cs.
- Restore fails: Ensure .NET 10 SDK is installed (
dotnet --version). - NuGet errors: Clear cache:
dotnet nuget locals all --clearand retry.
- Project fails to load: Check
.OzzGenfile is valid XML. Verify model provider paths are accessible. - Model provider refresh fails: For Empty, verify
Defaults/folder exists. - Engine output not appearing: Check
TargetFolderis accessible. Verify engine template is selected. Review Output window logs.
For deeper troubleshooting, see .github/copilot-instructions.md.