Skip to content

Task List Service

In order to help you build your own Solution, find below an example of a basic YAML model, serving as a "Hello World" for you to understand the power of our source code generator.

This example model reflects a use case for Task List Registration, which is intended to perform certain registration operations (CRUD) to the database.


YAML Example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
Name: TaskList # Solution name
RootNamespace: TaskList # Solution root namespace

# Business entities

Entities:
  - Name: Task
    KeyType: Guid
    Properties:
      - Name: Title
        Type: string
      - Name: Description
        Type: string
      - Name: DueDate
        Type: DateTimeOffset
      - Name: Status # 1-Created | 2-Doing | 3-Done
        Type: int

# Database instance types

DbInstances:
  - Name: MyDbInstance
    Type: PostgreSql
    #Type: SqlServer

Databases:
  - Name: TasksDb
    DbInstanceName: MyDbInstance

# Identity Server configuration section

IdentityConfig:
  DatabaseName: TasksDb # The database for Identity Server data storage

# Database data contexts

DbContexts:
- Name: TasksDbContext
  DatabaseName: TasksDb

# Data access repository pattern

Repositories:
- Name: TaskRepo
  DbContextName: TasksDbContext
  EntityName: Task

# Services and Controllers (CRUD)

Services:
- Name: TaskService
  Type: WebAPI
  Controllers:
  - Name: Task
    Type: CRUD
    EntityName: Task
    RepositoryName: TaskRepo
    Contexts:
    - Context: Create
      Rules: # Business rules performed only for the "Create" context
      - Name: AddInRepository
        Type: WriteOperationRule # Executes a business rule for persisting data in the database
        Order: 1

    - Context: Update
      Rules:
      - Name: UpdateInRepository
        Type: WriteOperationRule
        Order: 1

    - Context: UpdatePartial
      Rules:
      - Name: UpdateInRepository
        Type: WriteOperationRule
        Order: 1

    - Context: Delete
      Rules:
      - Name: DeleteInRepository
        Type: WriteOperationRule
        Order: 1

    - Context: ReadAll
      Rules:
      - Name: ReadInRepository
        Type: ReadOperationRule # Executes a business rule for reading data from the database
        Order: 1

    - Context: ReadByKey
      Rules:
      - Name: ReadInRepository
        Type: ReadOperationRule
        Order: 1

Back to top