This is small project designed to be a central place to generate transaction numbers, as well as keep track of their progression. This allows multiple transactional services to share a single reference number format for the ease of customers as well as link related transactions together.
The injection of the dependencies for the UtrnGenerator are grouped together under the ServiceCollectionExtensions in UtrnGenerator.Core. Below is a table of available configuration.
| Name | Mandatory | Type | Description |
|---|---|---|---|
| UTRN__DBPROVIDER | N | Enum | Available values: MySql, Sqlite, SqlServer. Defaults to Sqlite. |
| UTRN__DBCONNECTIONSTRING | N | String | Connection string for the DB. Defaults to a SQLite connection string: DataSource=UtrnGenerator.db |
| UTRN__PAGINGDEFAULTSIZE | N | Int | Default page size for returning lists of entities. Defaults to 25 |
| UTRN__PAGINGMAXSIZE | N | Int | Sets a max size for a page of results. Defaults to 200 |
| UTRN__UTRNPREFIX | N | string | Configures the prefix when generating transaction reference. |
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"Utrn": {
"DbProvider": "Sqlite",
"DbConnectionString": "DataSource=UtrnGenerator.db",
"PagingDefaultSize": 50,
"PagingMaxSize": 200
}
}

The database is designed to be simple to manage and work with, whilst also providing the ability to report on activity and track the progress of transactions:
A number of database providers are supported:
On startup, EFCore will evaluate if there are and pending migrations for the configured database and perform a migration if needed. Each database provider has it's own UtrnGenerator.Data project which references UtrnGenerator.Data. This allows for the model to be shared across all providers.
To help with defining migrations in the future, a simple AddMigration.ps1 PowerShell script has been added which will handle creating a migration in each provider. This will run the dotnet ef migrations add command using local connection strings where possible.
MySql requires a connection string to be provided as a parameter. An easy way of getting a running instance is using Docker:
docker run -it --rm -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=utrngenerator -e MYSQL_USER=utrngenerator -e MYSQL_PASSWORD=password -p 3306:3306 --name mariadb mariadb:10.8
With the instance running, it can then be used to develop against or for adding migrations to the UtrnGenerator.Data.MySql project. An example of using the AddMigrations.ps1 script can be found below:
.\scripts\AddMigration.ps1 -Name Test -MySqlConnectionString "Server=localhost;Database=utrngenerator;Uid=utrngenerator;Pwd=password;" -InformationAction Continue
Content type
Image
Digest
sha256:1b738e8a6…
Size
61 MB
Last updated
about 4 years ago
docker pull milkyware/utrngenerator-api