-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy pathWhereConfig.cs
More file actions
51 lines (48 loc) · 1.99 KB
/
Copy pathWhereConfig.cs
File metadata and controls
51 lines (48 loc) · 1.99 KB
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
// Copyright (c) Avanade. Licensed under the MIT License. See https://github.com/Avanade/Beef
using OnRamp.Config;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
namespace Beef.CodeGen.Config.Database
{
/// <summary>
/// Represents the stored procedure where statement configuration.
/// </summary>
[CodeGenClass("Where", Title = "'Where' object (database-driven)",
Description = "The `Where` object defines an additional where `Statement` to be added. This is in addition to those automatically added based on the `StoredProcedure.Type`.",
ExampleMarkdown = @"A YAML example is as follows:
``` yaml
tables:
- { name: Table, schema: Test, create: true, update: true, upsert: true, delete: true, merge: true, udt: true, getAll: true, getAllOrderBy: [ Name Des ], excludeColumns: [ Other ], permission: TestSec,
storedProcedures: [
{ name: GetByArgs, type: GetColl, excludeColumns: [ Count ],
parameters: [
{ name: Name, nullable: true, operator: LIKE },
{ name: MinCount, operator: GE, column: Count },
{ name: MaxCount, operator: LE, column: Count, nullable: true }
]
},
{ name: Get, type: Get, withHints: NOLOCK,
execute: [
{ statement: EXEC Demo.Before, location: Before },
{ statement: EXEC Demo.After }
]
},
{ name: Update, type: Update }
]
}
```")]
[CodeGenCategory("Key", Title = "Provides the _key_ configuration.")]
public class WhereConfig : ConfigBase<CodeGenConfig, StoredProcedureConfig>
{
/// <summary>
/// Gets or sets the where statement (TSQL).
/// </summary>
[JsonPropertyName("statement")]
[CodeGenProperty("Key", Title = "The where statement (TSQL).", IsMandatory = true, IsImportant = true)]
public string? Statement { get; set; }
/// <summary>
/// <inheritdoc/>
/// </summary>
protected override Task PrepareAsync() => Task.CompletedTask;
}
}