Source Generation
Source Generation
Repo
Generated code allows developers to skip over tedium and keep focused on important design details.
My source generation platform aims to establish a definitive .NET project architecture of declarative descriptor languages. Several backend and frontend tasks follow patterns which can be boilerplated from a source descriptor document.
Account.model
schema {int Id,
string Email = {""},
string FirstName = {""},
string LastName = {""}
}
partial WithPassword {
string PasswordScheme = {""},
string PasswordHash = {""},
string PasswordSalt = {""},
DateTime? PasswordSet
}
repo {
dbo.Account_GetById(int id)
=> Account,
dbo.Account_GetWithPassword(string email)
=> Account.WithPassword,
...}
service {
AttemptLogin(string email, string password)
=> Account.WithSession,
LogOut(),
ResetPassword(string resetToken, string password),
...}
DTO classes are generated for the table schema and derived partials.
var dto = new Account(); dto = new Account.WithPassword();
A service interface is generated which must be implemented fully in the application backend.
public class AccountService : Account.IBackendService { ... }
Also accompanying functions to call SQL stored procedures and API endpoints.
Account.Repository repo; repo.Account_GetWithPassword(...); Account.IService service; service.AttemptLogin(...);
The developer can build large portions of the application codebase from succinct lines leveraging structured generation patterns.
Language Server with Visual Studio integration
(above: source generation language server running next to Visual Studio 2022)
Syntax highlighting and validation
(above: custom syntax highlighting extension with semantic colors)
(above: simple validation messages for syntax correctness)