/nibelheim_cs

Clone of nibelheim_ts to play around with csharp

Primary LanguageC#MIT LicenseMIT

TL/DR;

  • Test project to play around with csharp and mono repos
  • Challenge the power of yacg
  • Beside playing with codeGen has this project no purpose or deeper sense
# kick off after a fresh clone
git clone git@github.com:OkieOth/nibelheim_cs.git

Requirements

  • .NET v6
  • docker
  • bash

(The project is developed and tested under Ubuntu 20.04 with the help of vscode)

Usage

Useful link: https://developerslogblog.wordpress.com/2019/07/02/how-to-create-a-net-core-multi-project-solution-in-linux/

# create the project container
dotnet new sln -o .

# create the types code project
dotnet new classlib -o src/nibelheim.types

# create test project for the types project
dotnet new xunit -o tests/nibelheim.types.tests

# link both projects with the workspace
dotnet sln nibelheim_cs.sln add src/nibelheim.types/nibelheim.types.csproj
dotnet sln nibelheim_cs.sln add tests/nibelheim.types.tests/nibelheim.types.tests.csproj

# link the types project with the types.test project
dotnet add tests/nibelheim.types.tests/nibelheim.types.tests.csproj reference src/nibelheim.types/nibelheim.types.csproj

CodeGen (WIP)

Attention, the codegen is using the latest version of ghcr.io/okieoth/yacg. If you run into complile issues the you have maybe to old latest version on your machine. There are small but breaking changes from v3.* to v4.*. Pull the new latest version (currently 4.0.0) and the problems should be gone.

  • The use codeGen template are in ./codeGen/*.mako
  • The configuration for the whole codeGen project is in ./codeGen/config/generateAll.json
  • To run the codeGen execute ./bin/generateAll.sh
  • To run only specific tasks run specify the tasks switch of yacg (available from v3.3.0)
# run only the 'types' task from the codeGen config
./bin/generateAll.sh --tasks types

# run the 'types' and 'types_puml' tasks from the codeGen config
./bin/generateAll.sh --tasks types types_puml

# delete all generated files from the repo
npm run clean

# generate all code
npm run codeGen

# count the lines of contained template code
npm run countTemplateLines

# count the lines of generated code
npm run countGeneratedLines

More information are here ...

Available Tasks

Name Description
types_puml generate PlantUml file from the used mode
types generate interfaces from the model
type_equal functions to test equality of objects
type_factories generate functions to create instances of the types
type_factories_tests generate tests for type factories
type_quards generate functions to validate types
type_guards_tests generate tests for type validation
types_random generate functions to create random data
types_random_tests generate tests for the random data functions
dao_uuid generates the functions to convert uuids
dao_uuid_tests generates the tests for the functions to convert uuids
dao_insert generates the functions to insert data into mongodb
dao_delete generates the functions to delete data from mongodb
dao_delete_tests generates the tests for the mongo delete functions
dao_update generates the functions to update data in mongodb
dao_update_tests generates the tests for the mongo update functions
dao_find generates the functions to query data from mongodb
dao_find_tests generates the tests for the mongo find functions