diff --git a/CHANGELOG.md b/CHANGELOG.md
index 80513c268..1febda911 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,12 @@
Represents the **NuGet** versions.
+## v5.8.0
+- *Fixed:* Upgraded `CoreEx` (`v3.8.0`) to include all related fixes and improvements; `WebApi` class supports returning value of `IActionResult` as-is.
+- *Enhancement:* Updated code-generation to support `IActionResult` return type for `WebApi` operations. The following `operation` YAML properties enable:
+ - New `webApiProduces: [ 'text/plain' ]` where the value is a `Produces` content type array (supports multiple) to override the default; for example `[Produces("text/plain")]`.
+ - New `webApiProducesResponseType: none` indicates that the resulting generated code does _not_ include the response type; for example `[ProducesResponseType((int)HttpStatusCode.OK)]`.
+
## v5.7.4
- *Fixed:* Upgraded `CoreEx` (`v3.7.2`) to include all related fixes and improvements; updated reference data code-generation template and samples as a result.
diff --git a/Common.targets b/Common.targets
index 0a5a321e4..da632cde9 100644
--- a/Common.targets
+++ b/Common.targets
@@ -1,6 +1,6 @@
- 5.7.4
+ 5.8.0
preview
Avanade
Avanade
diff --git a/docs/Entity-Operation-Config.md b/docs/Entity-Operation-Config.md
index 767500a04..9f146b5a0 100644
--- a/docs/Entity-Operation-Config.md
+++ b/docs/Entity-Operation-Config.md
@@ -66,7 +66,7 @@ Property | Description
**`name`** | The unique operation name. [Mandatory]
**`type`** | The type of operation that is to be code-generated. Valid options are: `Get`, `GetColl`, `Create`, `Update`, `Patch`, `Delete`, `Custom`.
† Defaults to `Custom`.
`text` | The text for use in comments.
† The `Text` will be defaulted for all the `Operation.Type` options with the exception of `Custom`. To create a `` within use moustache shorthand (e.g. {{Xxx}}).
-**`primaryKey`** | Indicates whether the properties marked as a primary key (`Property.PrimaryKey`) are to be used as the parameters.
† This simplifies the specification of these properties versus having to declare each specifically.
+**`primaryKey`** | Indicates whether the properties marked as a primary key (`Property.PrimaryKey`) are to be used as the parameters.
† This simplifies the specification of these properties as parameters versus having to declare each specifically. Each of the parameters will also be set to be mandatory.
**`paging`** | Indicates whether a `PagingArgs` argument is to be added to the operation to enable (standardized) paging related logic.
`valueType` | The .NET value parameter `Type` for the operation.
† Defaults to the parent `Entity.Name` where the `Operation.Type` options are `Create` or `Update`.
`returnType` | The .NET return `Type` for the operation.
† Defaults to the parent `Entity.Name` where the `Operation.Type` options are `Get`, `GetColl`, `Create` or `Update`; otherwise, defaults to `void`.
@@ -112,6 +112,8 @@ Property | Description
`webApiConcurrency` | Indicates whether the Web API is responsible for managing (simulating) concurrency via auto-generated ETag.
† This provides an alternative where the underlying data source does not natively support optimistic concurrency (native support should always be leveraged as a priority). Where the `Operation.Type` is `Update` or `Patch`, the request ETag will be matched against the response for a corresponding `Get` operation to verify no changes have been made prior to updating. For this to function correctly the .NET response Type for the `Get` must be the same as that returned from the corresponding `Create`, `Update` and `Patch` (where applicable) as the generated ETag is a SHA256 hash of the resulting JSON. Defaults to `Entity.WebApiConcurrency`.
`webApiGetOperation` | The corresponding `Get` method name (in the `XxxManager`) where the `Operation.Type` is `Update` and `SimulateConcurrency` is `true`.
† Defaults to `Get`. Specify either just the method name (e.g. `OperationName`) or, interface and method name (e.g. `IXxxManager.OperationName`) to be invoked where in a different `YyyManager.OperationName`.
`webApiUpdateOperation` | The corresponding `Update` method name (in the `XxxManager`) where the `Operation.Type` is `Patch`.
† Defaults to `Update`. Specify either just the method name (e.g. `OperationName`) or, interface and method name (e.g. `IXxxManager.OperationName`) to be invoked where in a different `YyyManager.OperationName`.
+`webApiProduces` | The value(s) for the optional `[Produces()]` attribute for the operation within the Web Api Controller for the Swagger/OpenAPI documentation.
+`webApiProducesResponseType` | The `[ProducesResponseType()]` attribute `typeof` for the operation within the Web Api Controller for the Swagger/OpenAPI documentation.
† Defaults to the _Common_ type. A value of `None`, `none` or `` will ensure no type is emitted.
diff --git a/samples/Cdr.Banking/Cdr.Banking.Api/Cdr.Banking.Api.csproj b/samples/Cdr.Banking/Cdr.Banking.Api/Cdr.Banking.Api.csproj
index d43b75c2b..598f508a4 100644
--- a/samples/Cdr.Banking/Cdr.Banking.Api/Cdr.Banking.Api.csproj
+++ b/samples/Cdr.Banking/Cdr.Banking.Api/Cdr.Banking.Api.csproj
@@ -5,7 +5,7 @@
true
-
+
diff --git a/samples/Cdr.Banking/Cdr.Banking.Api/Controllers/Generated/AccountController.cs b/samples/Cdr.Banking/Cdr.Banking.Api/Controllers/Generated/AccountController.cs
index 2cb3d651f..ad46fa9da 100644
--- a/samples/Cdr.Banking/Cdr.Banking.Api/Controllers/Generated/AccountController.cs
+++ b/samples/Cdr.Banking/Cdr.Banking.Api/Controllers/Generated/AccountController.cs
@@ -61,4 +61,16 @@ public Task GetDetail(string? accountId)
[ProducesResponseType((int)HttpStatusCode.NotFound)]
public Task GetBalance(string? accountId)
=> _webApi.GetWithResultAsync(Request, p => _manager.GetBalanceAsync(accountId));
+
+ ///
+ /// Get statement (file).
+ ///
+ /// The identifier.
+ /// A resultant .
+ [HttpGet("api/v1/banking/accounts/{accountId}/statement")]
+ [Produces("text/plain")]
+ [ProducesResponseType((int)HttpStatusCode.OK)]
+ [ProducesResponseType((int)HttpStatusCode.NoContent)]
+ public Task GetStatement(string? accountId)
+ => _webApi.GetWithResultAsync(Request, p => _manager.GetStatementAsync(accountId), alternateStatusCode: HttpStatusCode.NoContent, operationType: CoreEx.OperationType.Unspecified);
}
\ No newline at end of file
diff --git a/samples/Cdr.Banking/Cdr.Banking.Business/Cdr.Banking.Business.csproj b/samples/Cdr.Banking/Cdr.Banking.Business/Cdr.Banking.Business.csproj
index 3a80bceb3..88044314a 100644
--- a/samples/Cdr.Banking/Cdr.Banking.Business/Cdr.Banking.Business.csproj
+++ b/samples/Cdr.Banking/Cdr.Banking.Business/Cdr.Banking.Business.csproj
@@ -11,7 +11,8 @@
-
-
+
+
+
\ No newline at end of file
diff --git a/samples/Cdr.Banking/Cdr.Banking.Business/Data/AccountData.cs b/samples/Cdr.Banking/Cdr.Banking.Business/Data/AccountData.cs
index e1f451eed..506e41c16 100644
--- a/samples/Cdr.Banking/Cdr.Banking.Business/Data/AccountData.cs
+++ b/samples/Cdr.Banking/Cdr.Banking.Business/Data/AccountData.cs
@@ -1,4 +1,5 @@
using Microsoft.Azure.Cosmos.Linq;
+using System.Text;
namespace Cdr.Banking.Business.Data;
@@ -48,4 +49,11 @@ partial void AccountDataCtor()
return bal.Adjust(b => b.Id = a.Id);
});
}
+
+ ///
+ /// Gets the statement (file) for the specified account.
+ ///
+ private Task> GetStatementOnImplementationAsync(string? accountId)
+ => Result.GoAsync(GetDetailAsync(accountId))
+ .WhenAs(d => d is not null, d => new FileContentResult(Encoding.UTF8.GetBytes($"Statement for Account '{d.AccountNumber}'."), "text/plain") { FileDownloadName = $"{accountId}.statement.txt" });
}
\ No newline at end of file
diff --git a/samples/Cdr.Banking/Cdr.Banking.Business/Data/Generated/AccountData.cs b/samples/Cdr.Banking/Cdr.Banking.Business/Data/Generated/AccountData.cs
index 6719ffa5c..90082d3aa 100644
--- a/samples/Cdr.Banking/Cdr.Banking.Business/Data/Generated/AccountData.cs
+++ b/samples/Cdr.Banking/Cdr.Banking.Business/Data/Generated/AccountData.cs
@@ -32,6 +32,9 @@ public Task> GetAccountsAsync(AccountArgs? args,
///
public Task> GetBalanceAsync(string? accountId) => GetBalanceOnImplementationAsync(accountId);
+ ///
+ public Task> GetStatementAsync(string? accountId) => GetStatementOnImplementationAsync(accountId);
+
///
/// Provides the to Entity Framework mapping.
///
diff --git a/samples/Cdr.Banking/Cdr.Banking.Business/Data/Generated/IAccountData.cs b/samples/Cdr.Banking/Cdr.Banking.Business/Data/Generated/IAccountData.cs
index e4f6be0fe..ce3659667 100644
--- a/samples/Cdr.Banking/Cdr.Banking.Business/Data/Generated/IAccountData.cs
+++ b/samples/Cdr.Banking/Cdr.Banking.Business/Data/Generated/IAccountData.cs
@@ -30,4 +30,11 @@ public partial interface IAccountData
/// The identifier.
/// The selected where found.
Task> GetBalanceAsync(string? accountId);
+
+ ///
+ /// Get statement (file).
+ ///
+ /// The identifier.
+ /// A resultant .
+ Task> GetStatementAsync(string? accountId);
}
\ No newline at end of file
diff --git a/samples/Cdr.Banking/Cdr.Banking.Business/DataSvc/Generated/AccountDataSvc.cs b/samples/Cdr.Banking/Cdr.Banking.Business/DataSvc/Generated/AccountDataSvc.cs
index 459975b0a..e0849326e 100644
--- a/samples/Cdr.Banking/Cdr.Banking.Business/DataSvc/Generated/AccountDataSvc.cs
+++ b/samples/Cdr.Banking/Cdr.Banking.Business/DataSvc/Generated/AccountDataSvc.cs
@@ -30,4 +30,7 @@ public AccountDataSvc(IAccountData data, IRequestCache cache)
///
public Task> GetBalanceAsync(string? accountId) => Result.Go().CacheGetOrAddAsync(_cache, accountId, () => _data.GetBalanceAsync(accountId));
+
+ ///
+ public Task> GetStatementAsync(string? accountId) => _data.GetStatementAsync(accountId);
}
\ No newline at end of file
diff --git a/samples/Cdr.Banking/Cdr.Banking.Business/DataSvc/Generated/IAccountDataSvc.cs b/samples/Cdr.Banking/Cdr.Banking.Business/DataSvc/Generated/IAccountDataSvc.cs
index 10d3061f2..ccd38dd53 100644
--- a/samples/Cdr.Banking/Cdr.Banking.Business/DataSvc/Generated/IAccountDataSvc.cs
+++ b/samples/Cdr.Banking/Cdr.Banking.Business/DataSvc/Generated/IAccountDataSvc.cs
@@ -30,4 +30,11 @@ public partial interface IAccountDataSvc
/// The identifier.
/// The selected where found.
Task> GetBalanceAsync(string? accountId);
+
+ ///
+ /// Get statement (file).
+ ///
+ /// The identifier.
+ /// A resultant .
+ Task> GetStatementAsync(string? accountId);
}
\ No newline at end of file
diff --git a/samples/Cdr.Banking/Cdr.Banking.Business/Generated/AccountManager.cs b/samples/Cdr.Banking/Cdr.Banking.Business/Generated/AccountManager.cs
index 8c28976fa..5781a3323 100644
--- a/samples/Cdr.Banking/Cdr.Banking.Business/Generated/AccountManager.cs
+++ b/samples/Cdr.Banking/Cdr.Banking.Business/Generated/AccountManager.cs
@@ -41,4 +41,11 @@ public Task> GetAccountsAsync(AccountArgs? args,
return Result.Go().Requires(accountId)
.ThenAsAsync(() => _dataService.GetBalanceAsync(accountId));
}, InvokerArgs.Read);
+
+ ///
+ public Task> GetStatementAsync(string? accountId) => ManagerInvoker.Current.InvokeAsync(this, (_, ct) =>
+ {
+ return Result.Go().Requires(accountId)
+ .ThenAsAsync(() => _dataService.GetStatementAsync(accountId));
+ }, InvokerArgs.Unspecified);
}
\ No newline at end of file
diff --git a/samples/Cdr.Banking/Cdr.Banking.Business/Generated/IAccountManager.cs b/samples/Cdr.Banking/Cdr.Banking.Business/Generated/IAccountManager.cs
index 50da81001..432e4a8aa 100644
--- a/samples/Cdr.Banking/Cdr.Banking.Business/Generated/IAccountManager.cs
+++ b/samples/Cdr.Banking/Cdr.Banking.Business/Generated/IAccountManager.cs
@@ -30,4 +30,11 @@ public partial interface IAccountManager
/// The identifier.
/// The selected where found.
Task> GetBalanceAsync(string? accountId);
+
+ ///
+ /// Get statement (file).
+ ///
+ /// The identifier.
+ /// A resultant .
+ Task> GetStatementAsync(string? accountId);
}
\ No newline at end of file
diff --git a/samples/Cdr.Banking/Cdr.Banking.Business/GlobalUsings.cs b/samples/Cdr.Banking/Cdr.Banking.Business/GlobalUsings.cs
index bf6d663f8..a1ea938b1 100644
--- a/samples/Cdr.Banking/Cdr.Banking.Business/GlobalUsings.cs
+++ b/samples/Cdr.Banking/Cdr.Banking.Business/GlobalUsings.cs
@@ -15,6 +15,7 @@
global using CoreEx.Results;
global using CoreEx.Validation;
global using CoreEx.Validation.Rules;
+global using Microsoft.AspNetCore.Mvc;
global using Microsoft.Extensions.Configuration;
global using Microsoft.Extensions.Logging;
global using System;
diff --git a/samples/Cdr.Banking/Cdr.Banking.CodeGen/entity.beef-5.yaml b/samples/Cdr.Banking/Cdr.Banking.CodeGen/entity.beef-5.yaml
index 9bc6d86cf..8254bcbeb 100644
--- a/samples/Cdr.Banking/Cdr.Banking.CodeGen/entity.beef-5.yaml
+++ b/samples/Cdr.Banking/Cdr.Banking.CodeGen/entity.beef-5.yaml
@@ -52,7 +52,15 @@ entities:
# Route requires accountId; e.g. api/v1/banking/accounts/{accountId}/balance
# Data access logic cannot be auto-implemented.
#
- { name: GetBalance, text: 'Get {{Account}} {{Balance}}', type: Get, returnType: Balance, webApiRoute: '{accountId}/balance', primaryKey: true, autoImplement: None }
+ { name: GetBalance, text: 'Get {{Account}} {{Balance}}', type: Get, returnType: Balance, webApiRoute: '{accountId}/balance', primaryKey: true, autoImplement: None },
+ # Operation to get an Account statement _file_.
+ # Operation is 'Custom' to specifically override and manually implement data.
+ # ReturnType of FileContentResult (standard ASP.NET) is an IActionResult which will be returned as-is.
+ # PrimaryKey="true" indicates that all properties marked as PrimaryKey are to be used for parameters (avoids having to explicitly define again).
+ # WebApiProducesResponseType="none" indicates that the [ProducesResponseType()] attribute should not include the response type (also ensures that the Agent code does not include response type).
+ # WebApiProduces enables specification of the [Produces()] attribute and corresponding value(s) array.
+ #
+ { name: GetStatement, text: 'Get {{Account}} statement (file)', type: Custom, primaryKey: true, returnType: FileContentResult?, webApiMethod: HttpGet, webApiRoute: '{accountId}/statement', webApiProducesResponseType: none, webApiProduces: [ text/plain ] }
]
}
diff --git a/samples/Cdr.Banking/Cdr.Banking.Common/Agents/Generated/AccountAgent.cs b/samples/Cdr.Banking/Cdr.Banking.Common/Agents/Generated/AccountAgent.cs
index 4acafcee7..cadf40ce2 100644
--- a/samples/Cdr.Banking/Cdr.Banking.Common/Agents/Generated/AccountAgent.cs
+++ b/samples/Cdr.Banking/Cdr.Banking.Common/Agents/Generated/AccountAgent.cs
@@ -44,5 +44,9 @@ public Task> GetAccountsAsync(AccountArgs? a
///
public Task> GetBalanceAsync(string? accountId, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default)
=> GetAsync("api/v1/banking/accounts/{accountId}/balance", requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg("accountId", accountId)), cancellationToken: cancellationToken);
+
+ ///
+ public Task GetStatementAsync(string? accountId, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default)
+ => GetAsync("api/v1/banking/accounts/{accountId}/statement", requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg("accountId", accountId)), cancellationToken: cancellationToken);
}
}
\ No newline at end of file
diff --git a/samples/Cdr.Banking/Cdr.Banking.Common/Agents/Generated/IAccountAgent.cs b/samples/Cdr.Banking/Cdr.Banking.Common/Agents/Generated/IAccountAgent.cs
index b62494753..51de7378e 100644
--- a/samples/Cdr.Banking/Cdr.Banking.Common/Agents/Generated/IAccountAgent.cs
+++ b/samples/Cdr.Banking/Cdr.Banking.Common/Agents/Generated/IAccountAgent.cs
@@ -49,5 +49,14 @@ public partial interface IAccountAgent
/// The .
/// A .
Task> GetBalanceAsync(string? accountId, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default);
+
+ ///
+ /// Get statement (file).
+ ///
+ /// The identifier.
+ /// The optional .
+ /// The .
+ /// A .
+ Task GetStatementAsync(string? accountId, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/samples/Cdr.Banking/Cdr.Banking.Common/Agents/Generated/ReferenceDataAgent.cs b/samples/Cdr.Banking/Cdr.Banking.Common/Agents/Generated/ReferenceDataAgent.cs
index 9b318159f..7c6f53f8b 100644
--- a/samples/Cdr.Banking/Cdr.Banking.Common/Agents/Generated/ReferenceDataAgent.cs
+++ b/samples/Cdr.Banking/Cdr.Banking.Common/Agents/Generated/ReferenceDataAgent.cs
@@ -35,28 +35,28 @@ public ReferenceDataAgent(HttpClient client, IJsonSerializer jsonSerializer, Cor
: base(client, jsonSerializer, executionContext, settings, logger) { }
///
- public Task> OpenStatusGetAllAsync(ReferenceDataFilter? args = null, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default) =>
- GetAsync("api/v1/ref/openstatuses", requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg("args", args!, HttpArgType.FromUriUseProperties)), cancellationToken);
+ public Task> OpenStatusGetAllAsync(ReferenceDataFilter? args = null, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default)
+ => GetAsync("api/v1/ref/openstatuses", requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg("args", args!, HttpArgType.FromUriUseProperties)), cancellationToken);
///
- public Task> ProductCategoryGetAllAsync(ReferenceDataFilter? args = null, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default) =>
- GetAsync("api/v1/ref/productcategories", requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg("args", args!, HttpArgType.FromUriUseProperties)), cancellationToken);
+ public Task> ProductCategoryGetAllAsync(ReferenceDataFilter? args = null, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default)
+ => GetAsync("api/v1/ref/productcategories", requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg("args", args!, HttpArgType.FromUriUseProperties)), cancellationToken);
///
- public Task> AccountUTypeGetAllAsync(ReferenceDataFilter? args = null, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default) =>
- GetAsync("api/v1/ref/accountutypes", requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg("args", args!, HttpArgType.FromUriUseProperties)), cancellationToken);
+ public Task> AccountUTypeGetAllAsync(ReferenceDataFilter? args = null, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default)
+ => GetAsync("api/v1/ref/accountutypes", requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg("args", args!, HttpArgType.FromUriUseProperties)), cancellationToken);
///
- public Task> MaturityInstructionsGetAllAsync(ReferenceDataFilter? args = null, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default) =>
- GetAsync("api/v1/ref/maturityinstructions", requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg("args", args!, HttpArgType.FromUriUseProperties)), cancellationToken);
+ public Task> MaturityInstructionsGetAllAsync(ReferenceDataFilter? args = null, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default)
+ => GetAsync("api/v1/ref/maturityinstructions", requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg("args", args!, HttpArgType.FromUriUseProperties)), cancellationToken);
///
- public Task> TransactionTypeGetAllAsync(ReferenceDataFilter? args = null, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default) =>
- GetAsync("api/v1/ref/transactiontypes", requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg("args", args!, HttpArgType.FromUriUseProperties)), cancellationToken);
+ public Task> TransactionTypeGetAllAsync(ReferenceDataFilter? args = null, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default)
+ => GetAsync("api/v1/ref/transactiontypes", requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg("args", args!, HttpArgType.FromUriUseProperties)), cancellationToken);
///
- public Task> TransactionStatusGetAllAsync(ReferenceDataFilter? args = null, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default) =>
- GetAsync("api/v1/ref/transactionstatuses", requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg("args", args!, HttpArgType.FromUriUseProperties)), cancellationToken);
+ public Task> TransactionStatusGetAllAsync(ReferenceDataFilter? args = null, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default)
+ => GetAsync("api/v1/ref/transactionstatuses", requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg("args", args!, HttpArgType.FromUriUseProperties)), cancellationToken);
///
public Task GetNamedAsync(string[] names, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default)
diff --git a/samples/Cdr.Banking/Cdr.Banking.Common/Cdr.Banking.Common.csproj b/samples/Cdr.Banking/Cdr.Banking.Common/Cdr.Banking.Common.csproj
index 8b6557231..fbd519485 100644
--- a/samples/Cdr.Banking/Cdr.Banking.Common/Cdr.Banking.Common.csproj
+++ b/samples/Cdr.Banking/Cdr.Banking.Common/Cdr.Banking.Common.csproj
@@ -8,6 +8,6 @@
-
+
\ No newline at end of file
diff --git a/samples/Cdr.Banking/Cdr.Banking.Test/AccountTest.cs b/samples/Cdr.Banking/Cdr.Banking.Test/AccountTest.cs
index 302320bab..81cfa9d3c 100644
--- a/samples/Cdr.Banking/Cdr.Banking.Test/AccountTest.cs
+++ b/samples/Cdr.Banking/Cdr.Banking.Test/AccountTest.cs
@@ -259,5 +259,20 @@ public void D140_GetBalance_NoAuth()
}
#endregion
+
+ #region GetStatement
+
+ [Test]
+ public void E110_GetStatement_Found()
+ {
+ Agent()
+ .WithUser("jenny")
+ .Run(a => a.GetStatementAsync("23456789"))
+ .AssertOK()
+ .AssertContentTypePlainText()
+ .AssertContent("Statement for Account '23456789'.");
+ }
+
+ #endregion
}
}
\ No newline at end of file
diff --git a/samples/Cdr.Banking/Cdr.Banking.Test/Cdr.Banking.Test.csproj b/samples/Cdr.Banking/Cdr.Banking.Test/Cdr.Banking.Test.csproj
index aad6e9978..cda0f70da 100644
--- a/samples/Cdr.Banking/Cdr.Banking.Test/Cdr.Banking.Test.csproj
+++ b/samples/Cdr.Banking/Cdr.Banking.Test/Cdr.Banking.Test.csproj
@@ -35,7 +35,7 @@
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
diff --git a/samples/Demo/Beef.Demo.Api/Beef.Demo.Api.csproj b/samples/Demo/Beef.Demo.Api/Beef.Demo.Api.csproj
index 3e3000b60..e05c47817 100644
--- a/samples/Demo/Beef.Demo.Api/Beef.Demo.Api.csproj
+++ b/samples/Demo/Beef.Demo.Api/Beef.Demo.Api.csproj
@@ -12,7 +12,7 @@
-
+
diff --git a/samples/Demo/Beef.Demo.Api/Controllers/Generated/PersonController.cs b/samples/Demo/Beef.Demo.Api/Controllers/Generated/PersonController.cs
index 60fcef397..04590426d 100644
--- a/samples/Demo/Beef.Demo.Api/Controllers/Generated/PersonController.cs
+++ b/samples/Demo/Beef.Demo.Api/Controllers/Generated/PersonController.cs
@@ -365,6 +365,18 @@ public Task DeleteWithEf(Guid id)
[ProducesResponseType(typeof(Common.Entities.Person), (int)HttpStatusCode.OK)]
public Task PatchWithEf(Guid id)
=> _webApi.PatchAsync(Request, get: _ => _manager.GetAsync(id), put: p => _manager.UpdateAsync(p.Value!, id));
+
+ ///
+ /// Get Documentation.
+ ///
+ /// The identifier.
+ /// A resultant .
+ [HttpGet("api/v1/persons/{id}/documentation")]
+ [Produces("text/plain")]
+ [ProducesResponseType((int)HttpStatusCode.OK)]
+ [ProducesResponseType((int)HttpStatusCode.NoContent)]
+ public Task GetDocumentation(Guid id)
+ => _webApi.GetAsync(Request, p => _manager.GetDocumentationAsync(id), alternateStatusCode: HttpStatusCode.NoContent, operationType: CoreEx.OperationType.Unspecified);
}
#pragma warning restore
diff --git a/samples/Demo/Beef.Demo.Business/Beef.Demo.Business.csproj b/samples/Demo/Beef.Demo.Business/Beef.Demo.Business.csproj
index 1d0672442..789f97029 100644
--- a/samples/Demo/Beef.Demo.Business/Beef.Demo.Business.csproj
+++ b/samples/Demo/Beef.Demo.Business/Beef.Demo.Business.csproj
@@ -15,13 +15,14 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
diff --git a/samples/Demo/Beef.Demo.Business/Data/Generated/IPersonData.cs b/samples/Demo/Beef.Demo.Business/Data/Generated/IPersonData.cs
index c8fd54e4a..1978724ec 100644
--- a/samples/Demo/Beef.Demo.Business/Data/Generated/IPersonData.cs
+++ b/samples/Demo/Beef.Demo.Business/Data/Generated/IPersonData.cs
@@ -176,6 +176,13 @@ public partial interface IPersonData
///
/// The identifier.
Task DeleteWithEfAsync(Guid id);
+
+ ///
+ /// Get Documentation.
+ ///
+ /// The identifier.
+ /// A resultant .
+ Task GetDocumentationAsync(Guid id);
}
#pragma warning restore
diff --git a/samples/Demo/Beef.Demo.Business/Data/Generated/PersonData.cs b/samples/Demo/Beef.Demo.Business/Data/Generated/PersonData.cs
index 2bcdb7dd9..b1e0ff890 100644
--- a/samples/Demo/Beef.Demo.Business/Data/Generated/PersonData.cs
+++ b/samples/Demo/Beef.Demo.Business/Data/Generated/PersonData.cs
@@ -218,6 +218,9 @@ public Task DeleteWithEfAsync(Guid id) => DataInvoker.Current.InvokeAsync(this,
await Invoker.InvokeAsync(_deleteWithEfOnAfterAsync?.Invoke(id)).ConfigureAwait(false);
}, new InvokerArgs { ExceptionHandler = _deleteWithEfOnException });
+ ///
+ public Task GetDocumentationAsync(Guid id) => GetDocumentationOnImplementationAsync(id);
+
///
/// Provides the property and database column mapping.
///
diff --git a/samples/Demo/Beef.Demo.Business/Data/PersonData.cs b/samples/Demo/Beef.Demo.Business/Data/PersonData.cs
index 7753b7bc3..694ac8bd4 100644
--- a/samples/Demo/Beef.Demo.Business/Data/PersonData.cs
+++ b/samples/Demo/Beef.Demo.Business/Data/PersonData.cs
@@ -1,4 +1,6 @@
-namespace Beef.Demo.Business.Data
+using System.Text;
+
+namespace Beef.Demo.Business.Data
{
public partial class PersonData
{
@@ -145,5 +147,10 @@ await _db.StoredProcedure("[Demo].[spPersonUpdateDetail]")
// d2s.ForMember(s => s.Address, o => o.MapFrom(d => d));
// }
//}
+
+ private static Task GetDocumentationOnImplementationAsync(Guid id)
+ {
+ return Task.FromResult(new FileContentResult(Encoding.ASCII.GetBytes($"Documentation for '{id}'."), "text/plain"));
+ }
}
}
\ No newline at end of file
diff --git a/samples/Demo/Beef.Demo.Business/DataSvc/Generated/IPersonDataSvc.cs b/samples/Demo/Beef.Demo.Business/DataSvc/Generated/IPersonDataSvc.cs
index cf8497e3b..01d108691 100644
--- a/samples/Demo/Beef.Demo.Business/DataSvc/Generated/IPersonDataSvc.cs
+++ b/samples/Demo/Beef.Demo.Business/DataSvc/Generated/IPersonDataSvc.cs
@@ -195,6 +195,13 @@ public partial interface IPersonDataSvc
///
/// The identifier.
Task DeleteWithEfAsync(Guid id);
+
+ ///
+ /// Get Documentation.
+ ///
+ /// The identifier.
+ /// A resultant .
+ Task GetDocumentationAsync(Guid id);
}
#pragma warning restore
diff --git a/samples/Demo/Beef.Demo.Business/DataSvc/Generated/PersonDataSvc.cs b/samples/Demo/Beef.Demo.Business/DataSvc/Generated/PersonDataSvc.cs
index c9357b64f..8a23c7b91 100644
--- a/samples/Demo/Beef.Demo.Business/DataSvc/Generated/PersonDataSvc.cs
+++ b/samples/Demo/Beef.Demo.Business/DataSvc/Generated/PersonDataSvc.cs
@@ -40,6 +40,7 @@ public partial class PersonDataSvc : IPersonDataSvc
private Func? _createWithEfOnAfterAsync;
private Func? _updateWithEfOnAfterAsync;
private Func? _deleteWithEfOnAfterAsync;
+ private Func? _getDocumentationOnAfterAsync;
#endregion
@@ -269,6 +270,14 @@ public Task DeleteWithEfAsync(Guid id) => DataSvcInvoker.Current.InvokeAsync(thi
await Invoker.InvokeAsync(_deleteWithEfOnAfterAsync?.Invoke(id)).ConfigureAwait(false);
_events.PublishValueEvent(new Person { Id = id }, new Uri($"/person/{id}", UriKind.Relative), $"Demo.Person.{id}", "Delete");
}, new InvokerArgs { IncludeTransactionScope = true, EventPublisher = _events });
+
+ ///
+ public async Task GetDocumentationAsync(Guid id)
+ {
+ var r = await _data.GetDocumentationAsync(id).ConfigureAwait(false);
+ await Invoker.InvokeAsync(_getDocumentationOnAfterAsync?.Invoke(r, id)).ConfigureAwait(false);
+ return r;
+ }
}
#pragma warning restore
diff --git a/samples/Demo/Beef.Demo.Business/Generated/ContactManager.cs b/samples/Demo/Beef.Demo.Business/Generated/ContactManager.cs
index 0776c3cee..0f5eecb2b 100644
--- a/samples/Demo/Beef.Demo.Business/Generated/ContactManager.cs
+++ b/samples/Demo/Beef.Demo.Business/Generated/ContactManager.cs
@@ -47,7 +47,11 @@ public Task CreateAsync(Contact value) => ManagerInvoker.Current.Invoke
public Task UpdateAsync(Contact value, Guid id) => ManagerInvoker.Current.InvokeAsync(this, async (_, ct) =>
{
value.Required().Id = id;
- await value.Validate().Entity().With().ValidateAsync(true).ConfigureAwait(false);
+ await MultiValidator.Create()
+ .Add(id.Validate().Mandatory())
+ .Add(value.Validate().Mandatory().Entity().With())
+ .ValidateAsync(true).ConfigureAwait(false);
+
return await _dataService.UpdateAsync(value).ConfigureAwait(false);
}, InvokerArgs.Update);
diff --git a/samples/Demo/Beef.Demo.Business/Generated/IPersonManager.cs b/samples/Demo/Beef.Demo.Business/Generated/IPersonManager.cs
index 0cbc2b853..47954ac3e 100644
--- a/samples/Demo/Beef.Demo.Business/Generated/IPersonManager.cs
+++ b/samples/Demo/Beef.Demo.Business/Generated/IPersonManager.cs
@@ -211,6 +211,13 @@ public partial interface IPersonManager
///
/// The identifier.
Task DeleteWithEfAsync(Guid id);
+
+ ///
+ /// Get Documentation.
+ ///
+ /// The identifier.
+ /// A resultant .
+ Task GetDocumentationAsync(Guid id);
}
#pragma warning restore
diff --git a/samples/Demo/Beef.Demo.Business/Generated/PersonManager.cs b/samples/Demo/Beef.Demo.Business/Generated/PersonManager.cs
index c410ea64b..0c1c14173 100644
--- a/samples/Demo/Beef.Demo.Business/Generated/PersonManager.cs
+++ b/samples/Demo/Beef.Demo.Business/Generated/PersonManager.cs
@@ -147,6 +147,11 @@ public partial class PersonManager : IPersonManager
private Func? _deleteWithEfOnBeforeAsync;
private Func? _deleteWithEfOnAfterAsync;
+ private Func? _getDocumentationOnPreValidateAsync;
+ private Action? _getDocumentationOnValidate;
+ private Func? _getDocumentationOnBeforeAsync;
+ private Func? _getDocumentationOnAfterAsync;
+
#endregion
///
@@ -225,6 +230,7 @@ public Task UpdateAsync(Person value, Guid id) => ManagerInvoker.Current
Cleaner.CleanUp(value);
await Invoker.InvokeAsync(_updateOnPreValidateAsync?.Invoke(value, id)).ConfigureAwait(false);
await MultiValidator.Create()
+ .Add(id.Validate().Mandatory())
.Add(value.Validate().Mandatory().Entity().With())
.Additional(mv => _updateOnValidate?.Invoke(mv, value, id))
.ValidateAsync(true).ConfigureAwait(false);
@@ -242,6 +248,7 @@ public Task UpdateWithRollbackAsync(Person value, Guid id) => ManagerInv
Cleaner.CleanUp(value);
await Invoker.InvokeAsync(_updateWithRollbackOnPreValidateAsync?.Invoke(value, id)).ConfigureAwait(false);
await MultiValidator.Create()
+ .Add(id.Validate().Mandatory())
.Add(value.Validate().Mandatory().Entity().With())
.Additional(mv => _updateWithRollbackOnValidate?.Invoke(mv, value, id))
.ValidateAsync(true).ConfigureAwait(false);
@@ -394,6 +401,7 @@ public Task UpdateDetailAsync(PersonDetail value, Guid id) => Mana
Cleaner.CleanUp(value);
await Invoker.InvokeAsync(_updateDetailOnPreValidateAsync?.Invoke(value, id)).ConfigureAwait(false);
await MultiValidator.Create()
+ .Add(id.Validate().Mandatory())
.Add(value.Validate().Mandatory().Entity().With())
.Additional(mv => _updateDetailOnValidate?.Invoke(mv, value, id))
.ValidateAsync(true).ConfigureAwait(false);
@@ -496,6 +504,7 @@ await MultiValidator.Create()
Cleaner.CleanUp(id);
await Invoker.InvokeAsync(_invokeApiViaAgentOnPreValidateAsync?.Invoke(id)).ConfigureAwait(false);
await MultiValidator.Create()
+ .Add(id.Validate().Mandatory())
.Additional(mv => _invokeApiViaAgentOnValidate?.Invoke(mv, id))
.ValidateAsync(true).ConfigureAwait(false);
@@ -560,6 +569,7 @@ public Task UpdateWithEfAsync(Person value, Guid id) => ManagerInvoker.C
Cleaner.CleanUp(value);
await Invoker.InvokeAsync(_updateWithEfOnPreValidateAsync?.Invoke(value, id)).ConfigureAwait(false);
await MultiValidator.Create()
+ .Add(id.Validate().Mandatory())
.Add(value.Validate().Mandatory().Entity().With())
.Additional(mv => _updateWithEfOnValidate?.Invoke(mv, value, id))
.ValidateAsync(true).ConfigureAwait(false);
@@ -584,6 +594,22 @@ await MultiValidator.Create()
await _dataService.DeleteWithEfAsync(id).ConfigureAwait(false);
await Invoker.InvokeAsync(_deleteWithEfOnAfterAsync?.Invoke(id)).ConfigureAwait(false);
}, InvokerArgs.Delete);
+
+ ///
+ public Task GetDocumentationAsync(Guid id) => ManagerInvoker.Current.InvokeAsync(this, async (_, ct) =>
+ {
+ Cleaner.CleanUp(id);
+ await Invoker.InvokeAsync(_getDocumentationOnPreValidateAsync?.Invoke(id)).ConfigureAwait(false);
+ await MultiValidator.Create()
+ .Add(id.Validate().Mandatory())
+ .Additional(mv => _getDocumentationOnValidate?.Invoke(mv, id))
+ .ValidateAsync(true).ConfigureAwait(false);
+
+ await Invoker.InvokeAsync(_getDocumentationOnBeforeAsync?.Invoke(id)).ConfigureAwait(false);
+ var r = await _dataService.GetDocumentationAsync(id).ConfigureAwait(false);
+ await Invoker.InvokeAsync(_getDocumentationOnAfterAsync?.Invoke(r, id)).ConfigureAwait(false);
+ return Cleaner.Clean(r);
+ }, InvokerArgs.Unspecified);
}
#pragma warning restore
diff --git a/samples/Demo/Beef.Demo.Business/Generated/RobotManager.cs b/samples/Demo/Beef.Demo.Business/Generated/RobotManager.cs
index 8c28e8701..179c4d2fa 100644
--- a/samples/Demo/Beef.Demo.Business/Generated/RobotManager.cs
+++ b/samples/Demo/Beef.Demo.Business/Generated/RobotManager.cs
@@ -74,7 +74,7 @@ public Task> GetByArgsAsync(RobotArgs? args, Pagin
///
public Task RaisePowerSourceChangeAsync(Guid id, RefDataNamespace.PowerSource? powerSource) => ManagerInvoker.Current.InvokeAsync(this, (_, ct) =>
{
- return Result.Go()
+ return Result.Go().Requires(id)
.ThenAsync(() => RaisePowerSourceChangeOnImplementationAsync(id, powerSource));
}, InvokerArgs.Unspecified);
}
diff --git a/samples/Demo/Beef.Demo.Business/GlobalUsings.cs b/samples/Demo/Beef.Demo.Business/GlobalUsings.cs
index 16be7a988..5b4e9812e 100644
--- a/samples/Demo/Beef.Demo.Business/GlobalUsings.cs
+++ b/samples/Demo/Beef.Demo.Business/GlobalUsings.cs
@@ -21,6 +21,7 @@
global using CoreEx.Results;
global using CoreEx.Validation;
global using CoreEx.Validation.Rules;
+global using Microsoft.AspNetCore.Mvc;
global using Microsoft.Data.SqlClient;
global using Microsoft.EntityFrameworkCore;
global using Microsoft.Extensions.Configuration;
diff --git a/samples/Demo/Beef.Demo.CodeGen/Config/TestConfigEditor.cs b/samples/Demo/Beef.Demo.CodeGen/Config/TestConfigEditor.cs
index f226faecf..75d85e44d 100644
--- a/samples/Demo/Beef.Demo.CodeGen/Config/TestConfigEditor.cs
+++ b/samples/Demo/Beef.Demo.CodeGen/Config/TestConfigEditor.cs
@@ -1,5 +1,4 @@
using Beef.CodeGen.Config.Entity;
-using Newtonsoft.Json.Linq;
using OnRamp.Config;
using System.Threading.Tasks;
@@ -13,8 +12,8 @@ public Task AfterPrepareAsync(IRootConfig config)
foreach (var e in cgc.Entities)
{
// Look for the additional property added in the configuration file.
- if (e.TryGetExtraProperty("TestCodeGen", out JValue val) && val.ToObject())
- e.CustomProperties["TestExtra"] = $"XXX.{e.GetExtraProperty("TestExtra")}.XXX"; // Add a new custom property that can be referenced in the template.
+ if (e.TryGetExtraProperty("TestCodeGen", out var val) && val)
+ e.CustomProperties["TestExtra"] = $"XXX.{e.GetExtraProperty("TestExtra")}.XXX"; // Add a new custom property that can be referenced in the template.
}
return Task.CompletedTask;
diff --git a/samples/Demo/Beef.Demo.CodeGen/Generated/PersonCodeGenTest.cs b/samples/Demo/Beef.Demo.CodeGen/Generated/PersonCodeGenTest.cs
index aa93b9b5f..058f28406 100644
--- a/samples/Demo/Beef.Demo.CodeGen/Generated/PersonCodeGenTest.cs
+++ b/samples/Demo/Beef.Demo.CodeGen/Generated/PersonCodeGenTest.cs
@@ -2,9 +2,9 @@
Company: Beef
AppName: Demo
Entity name: Person
-Extra dictionary: [TestCodeGen, true],[TestExtra, Unknown-Config]
-Extra loop: TestCodeGen,true;TestExtra,Unknown-Config;
-Extra loop2: TestCodeGen,true;TestExtra,Unknown-Config;
+Extra dictionary: [TestCodeGen, True],[TestExtra, Unknown-Config]
+Extra loop: TestCodeGen,True;TestExtra,Unknown-Config
+Extra loop2: TestCodeGen,True;TestExtra,Unknown-Config
Extra lookup: Unknown-Config
Custom lookup: XXX.Unknown-Config.XXX
Custom lookup lowercase: xxx.unknown-config.xxx
diff --git a/samples/Demo/Beef.Demo.CodeGen/Generators/TestCodeGenerator.cs b/samples/Demo/Beef.Demo.CodeGen/Generators/TestCodeGenerator.cs
index eacc2a722..50c8ce413 100644
--- a/samples/Demo/Beef.Demo.CodeGen/Generators/TestCodeGenerator.cs
+++ b/samples/Demo/Beef.Demo.CodeGen/Generators/TestCodeGenerator.cs
@@ -1,5 +1,4 @@
using Beef.CodeGen.Config.Entity;
-using Newtonsoft.Json.Linq;
using OnRamp.Generators;
using System.Collections.Generic;
using System.Linq;
@@ -9,6 +8,6 @@ namespace Beef.Demo.CodeGen.Generators
public class TestCodeGenerator : CodeGeneratorBase
{
protected override IEnumerable SelectGenConfig(CodeGenConfig config)
- => config.Entities.Where(x => x.GetExtraProperty("TestCodeGen")?.ToObject() ?? false).AsEnumerable();
+ => config.Entities.Where(x => x.GetExtraProperty("TestCodeGen") ?? false).AsEnumerable();
}
}
\ No newline at end of file
diff --git a/samples/Demo/Beef.Demo.CodeGen/entity.beef-5.yaml b/samples/Demo/Beef.Demo.CodeGen/entity.beef-5.yaml
index 46f40c663..f407e4dbe 100644
--- a/samples/Demo/Beef.Demo.CodeGen/entity.beef-5.yaml
+++ b/samples/Demo/Beef.Demo.CodeGen/entity.beef-5.yaml
@@ -93,7 +93,11 @@ entities:
parameters: [
{ name: Id, text: '{{Person}} identifier', type: Guid, isMandatory: true }
]},
- { name: PatchWithEf, type: Patch, validator: PersonValidator, primaryKey: true, webApiRoute: 'ef/{id}', autoImplement: EntityFramework }
+ { name: PatchWithEf, type: Patch, validator: PersonValidator, primaryKey: true, webApiRoute: 'ef/{id}', autoImplement: EntityFramework },
+ { name: GetDocumentation, type: Custom, returnType: FileContentResult, webApiMethod: HttpGet, webApiRoute: '{id}/documentation', webApiProduces: [ text/plain ], webApiProducesResponseType: none,
+ parameters: [
+ { name: Id, text: '{{Person}} identifier', type: Guid, isMandatory: true }
+ ]}
]
}
diff --git a/samples/Demo/Beef.Demo.Common/Agents/Generated/IPersonAgent.cs b/samples/Demo/Beef.Demo.Common/Agents/Generated/IPersonAgent.cs
index 3cb4a2976..dca80d37f 100644
--- a/samples/Demo/Beef.Demo.Common/Agents/Generated/IPersonAgent.cs
+++ b/samples/Demo/Beef.Demo.Common/Agents/Generated/IPersonAgent.cs
@@ -305,6 +305,15 @@ public partial interface IPersonAgent
/// The .
/// A .
Task> PatchWithEfAsync(HttpPatchOption patchOption, string value, Guid id, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default);
+
+ ///
+ /// Get Documentation.
+ ///
+ /// The identifier.
+ /// The optional .
+ /// The .
+ /// A .
+ Task GetDocumentationAsync(Guid id, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default);
}
}
diff --git a/samples/Demo/Beef.Demo.Common/Agents/Generated/PersonAgent.cs b/samples/Demo/Beef.Demo.Common/Agents/Generated/PersonAgent.cs
index ba7636b69..f5a1961c8 100644
--- a/samples/Demo/Beef.Demo.Common/Agents/Generated/PersonAgent.cs
+++ b/samples/Demo/Beef.Demo.Common/Agents/Generated/PersonAgent.cs
@@ -155,6 +155,10 @@ public Task DeleteWithEfAsync(Guid id, HttpRequestOptions? requestOp
///
public Task> PatchWithEfAsync(HttpPatchOption patchOption, string value, Guid id, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default)
=> PatchAsync("api/v1/persons/ef/{id}", patchOption, value, requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg("id", id)), cancellationToken: cancellationToken);
+
+ ///
+ public Task GetDocumentationAsync(Guid id, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default)
+ => GetAsync("api/v1/persons/{id}/documentation", requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg("id", id)), cancellationToken: cancellationToken);
}
}
diff --git a/samples/Demo/Beef.Demo.Common/Agents/Generated/ReferenceDataAgent.cs b/samples/Demo/Beef.Demo.Common/Agents/Generated/ReferenceDataAgent.cs
index 4b662a140..0115cd061 100644
--- a/samples/Demo/Beef.Demo.Common/Agents/Generated/ReferenceDataAgent.cs
+++ b/samples/Demo/Beef.Demo.Common/Agents/Generated/ReferenceDataAgent.cs
@@ -38,36 +38,36 @@ public ReferenceDataAgent(HttpClient client, IJsonSerializer jsonSerializer, Cor
: base(client, jsonSerializer, executionContext, settings, logger) { }
///
- public Task> CountryGetAllAsync(ReferenceDataFilter? args = null, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default) =>
- GetAsync("api/v1/demo/ref/countries", requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg("args", args!, HttpArgType.FromUriUseProperties)), cancellationToken);
+ public Task> CountryGetAllAsync(ReferenceDataFilter? args = null, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default)
+ => GetAsync("api/v1/demo/ref/countries", requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg("args", args!, HttpArgType.FromUriUseProperties)), cancellationToken);
///
- public Task> USStateGetAllAsync(ReferenceDataFilter? args = null, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default) =>
- GetAsync("api/v1/demo/ref/usStates", requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg("args", args!, HttpArgType.FromUriUseProperties)), cancellationToken);
+ public Task> USStateGetAllAsync(ReferenceDataFilter? args = null, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default)
+ => GetAsync("api/v1/demo/ref/usStates", requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg("args", args!, HttpArgType.FromUriUseProperties)), cancellationToken);
///
- public Task> GenderGetAllAsync(ReferenceDataFilter? args = null, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default) =>
- GetAsync("api/v1/demo/ref/genders", requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg("args", args!, HttpArgType.FromUriUseProperties)), cancellationToken);
+ public Task> GenderGetAllAsync(ReferenceDataFilter? args = null, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default)
+ => GetAsync("api/v1/demo/ref/genders", requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg("args", args!, HttpArgType.FromUriUseProperties)), cancellationToken);
///
- public Task> EyeColorGetAllAsync(ReferenceDataFilter? args = null, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default) =>
- GetAsync("api/v1/demo/ref/eyeColors", requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg("args", args!, HttpArgType.FromUriUseProperties)), cancellationToken);
+ public Task> EyeColorGetAllAsync(ReferenceDataFilter? args = null, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default)
+ => GetAsync("api/v1/demo/ref/eyeColors", requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg("args", args!, HttpArgType.FromUriUseProperties)), cancellationToken);
///
- public Task> PowerSourceGetAllAsync(ReferenceDataFilter? args = null, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default) =>
- GetAsync("api/v1/demo/ref/powerSources", requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg("args", args!, HttpArgType.FromUriUseProperties)), cancellationToken);
+ public Task> PowerSourceGetAllAsync(ReferenceDataFilter? args = null, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default)
+ => GetAsync("api/v1/demo/ref/powerSources", requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg("args", args!, HttpArgType.FromUriUseProperties)), cancellationToken);
///
- public Task> CompanyGetAllAsync(ReferenceDataFilter? args = null, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default) =>
- GetAsync("api/v1/demo/ref/companies", requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg("args", args!, HttpArgType.FromUriUseProperties)), cancellationToken);
+ public Task> CompanyGetAllAsync(ReferenceDataFilter? args = null, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default)
+ => GetAsync("api/v1/demo/ref/companies", requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg("args", args!, HttpArgType.FromUriUseProperties)), cancellationToken);
///
- public Task> StatusGetAllAsync(ReferenceDataFilter? args = null, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default) =>
- GetAsync("api/v1/demo/ref/statuses", requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg("args", args!, HttpArgType.FromUriUseProperties)), cancellationToken);
+ public Task> StatusGetAllAsync(ReferenceDataFilter? args = null, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default)
+ => GetAsync("api/v1/demo/ref/statuses", requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg("args", args!, HttpArgType.FromUriUseProperties)), cancellationToken);
///
- public Task> CommunicationTypeGetAllAsync(ReferenceDataFilter? args = null, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default) =>
- GetAsync("api/v1/demo/ref/communicationTypes", requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg("args", args!, HttpArgType.FromUriUseProperties)), cancellationToken);
+ public Task> CommunicationTypeGetAllAsync(ReferenceDataFilter? args = null, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default)
+ => GetAsync("api/v1/demo/ref/communicationTypes", requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg("args", args!, HttpArgType.FromUriUseProperties)), cancellationToken);
///
public Task GetNamedAsync(string[] names, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default)
diff --git a/samples/Demo/Beef.Demo.Common/Beef.Demo.Common.csproj b/samples/Demo/Beef.Demo.Common/Beef.Demo.Common.csproj
index 61c9d4463..f83547788 100644
--- a/samples/Demo/Beef.Demo.Common/Beef.Demo.Common.csproj
+++ b/samples/Demo/Beef.Demo.Common/Beef.Demo.Common.csproj
@@ -7,7 +7,7 @@
-
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/samples/Demo/Beef.Demo.Database/Data/RefData.yaml b/samples/Demo/Beef.Demo.Database/Data/RefData.yaml
index f16143dee..8e0dc173b 100644
--- a/samples/Demo/Beef.Demo.Database/Data/RefData.yaml
+++ b/samples/Demo/Beef.Demo.Database/Data/RefData.yaml
@@ -1,5 +1,4 @@
-^Type: Beef.Database.Core.DefaultIdentifierGenerators
-Ref:
+Ref:
- $Country:
- NZ: New Zealand
- AU: Australia
diff --git a/samples/Demo/Beef.Demo.Test/Beef.Demo.Test.csproj b/samples/Demo/Beef.Demo.Test/Beef.Demo.Test.csproj
index 000b7f91b..4d2cdd09a 100644
--- a/samples/Demo/Beef.Demo.Test/Beef.Demo.Test.csproj
+++ b/samples/Demo/Beef.Demo.Test/Beef.Demo.Test.csproj
@@ -52,13 +52,13 @@
-
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
diff --git a/samples/My.Hr/My.Hr.Api/My.Hr.Api.csproj b/samples/My.Hr/My.Hr.Api/My.Hr.Api.csproj
index 0d4eeeec5..62ee0793a 100644
--- a/samples/My.Hr/My.Hr.Api/My.Hr.Api.csproj
+++ b/samples/My.Hr/My.Hr.Api/My.Hr.Api.csproj
@@ -5,7 +5,7 @@
true
-
+
diff --git a/samples/My.Hr/My.Hr.Business/My.Hr.Business.csproj b/samples/My.Hr/My.Hr.Business/My.Hr.Business.csproj
index 8498eab04..19944708d 100644
--- a/samples/My.Hr/My.Hr.Business/My.Hr.Business.csproj
+++ b/samples/My.Hr/My.Hr.Business/My.Hr.Business.csproj
@@ -5,10 +5,10 @@
true
-
-
-
-
+
+
+
+
\ No newline at end of file
diff --git a/samples/My.Hr/My.Hr.CodeGen/entity.beef-5.yaml b/samples/My.Hr/My.Hr.CodeGen/entity.beef-5.yaml
index 11ec0627e..6339c021f 100644
--- a/samples/My.Hr/My.Hr.CodeGen/entity.beef-5.yaml
+++ b/samples/My.Hr/My.Hr.CodeGen/entity.beef-5.yaml
@@ -95,7 +95,7 @@ entities:
# - EventSubject is overridden so that the action component will be Terminated.
# - AutoImplement is None as this will be implemented by the developer.
# - An additional Id parameter is passed; in this instance we do not use the PrimaryKey as we require the value to be passed down all the layers.
- { name: Terminate, text: 'Terminates an existing {{Employee}}', type: Update, valueType: TerminationDetail, validator: TerminationDetailValidator, webApiRoute: '{id}/terminate', webApiMethod: HttpPost, eventSubject: 'Hr.Employee:Terminated', autoImplement: None,
+ { name: Terminate, text: 'Terminates an existing {{Employee}}', type: Update, primaryKey: true, valueType: TerminationDetail, validator: TerminationDetailValidator, webApiRoute: '{id}/terminate', webApiMethod: HttpPost, eventSubject: 'Hr.Employee:Terminated', autoImplement: None,
parameters: [
{ name: Id, type: Guid, text: '{{Employee}} identifier' }
]
diff --git a/samples/My.Hr/My.Hr.Common/Agents/Generated/ReferenceDataAgent.cs b/samples/My.Hr/My.Hr.Common/Agents/Generated/ReferenceDataAgent.cs
index 169daf33a..921e887a7 100644
--- a/samples/My.Hr/My.Hr.Common/Agents/Generated/ReferenceDataAgent.cs
+++ b/samples/My.Hr/My.Hr.Common/Agents/Generated/ReferenceDataAgent.cs
@@ -35,24 +35,24 @@ public ReferenceDataAgent(HttpClient client, IJsonSerializer jsonSerializer, Cor
: base(client, jsonSerializer, executionContext, settings, logger) { }
///
- public Task> GenderGetAllAsync(ReferenceDataFilter? args = null, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default) =>
- GetAsync("ref/genders", requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg("args", args!, HttpArgType.FromUriUseProperties)), cancellationToken);
+ public Task> GenderGetAllAsync(ReferenceDataFilter? args = null, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default)
+ => GetAsync("ref/genders", requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg("args", args!, HttpArgType.FromUriUseProperties)), cancellationToken);
///
- public Task> TerminationReasonGetAllAsync(ReferenceDataFilter? args = null, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default) =>
- GetAsync("ref/terminationReasons", requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg("args", args!, HttpArgType.FromUriUseProperties)), cancellationToken);
+ public Task> TerminationReasonGetAllAsync(ReferenceDataFilter? args = null, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default)
+ => GetAsync("ref/terminationReasons", requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg("args", args!, HttpArgType.FromUriUseProperties)), cancellationToken);
///
- public Task> RelationshipTypeGetAllAsync(ReferenceDataFilter? args = null, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default) =>
- GetAsync("ref/relationshipTypes", requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg("args", args!, HttpArgType.FromUriUseProperties)), cancellationToken);
+ public Task> RelationshipTypeGetAllAsync(ReferenceDataFilter? args = null, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default)
+ => GetAsync("ref/relationshipTypes", requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg("args", args!, HttpArgType.FromUriUseProperties)), cancellationToken);
///
- public Task> USStateGetAllAsync(ReferenceDataFilter? args = null, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default) =>
- GetAsync("ref/usStates", requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg("args", args!, HttpArgType.FromUriUseProperties)), cancellationToken);
+ public Task> USStateGetAllAsync(ReferenceDataFilter? args = null, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default)
+ => GetAsync("ref/usStates", requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg("args", args!, HttpArgType.FromUriUseProperties)), cancellationToken);
///
- public Task> PerformanceOutcomeGetAllAsync(ReferenceDataFilter? args = null, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default) =>
- GetAsync("ref/performanceOutcomes", requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg("args", args!, HttpArgType.FromUriUseProperties)), cancellationToken);
+ public Task> PerformanceOutcomeGetAllAsync(ReferenceDataFilter? args = null, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default)
+ => GetAsync("ref/performanceOutcomes", requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg("args", args!, HttpArgType.FromUriUseProperties)), cancellationToken);
///
public Task GetNamedAsync(string[] names, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default)
diff --git a/samples/My.Hr/My.Hr.Common/My.Hr.Common.csproj b/samples/My.Hr/My.Hr.Common/My.Hr.Common.csproj
index 42e682af7..3cb51503f 100644
--- a/samples/My.Hr/My.Hr.Common/My.Hr.Common.csproj
+++ b/samples/My.Hr/My.Hr.Common/My.Hr.Common.csproj
@@ -4,6 +4,6 @@
enable
-
+
\ No newline at end of file
diff --git a/samples/My.Hr/My.Hr.Test/Apis/ReferenceDataTest.cs b/samples/My.Hr/My.Hr.Test/Apis/ReferenceDataTest.cs
index aff1b1a2d..70baf1fb9 100644
--- a/samples/My.Hr/My.Hr.Test/Apis/ReferenceDataTest.cs
+++ b/samples/My.Hr/My.Hr.Test/Apis/ReferenceDataTest.cs
@@ -36,6 +36,6 @@ public void A130_GetNamed()
Agent()
.Run(a => a.GetNamedAsync(new string[] { "Gender" }))
.AssertOK()
- .AssertJsonFromResource("RefDataGetNamed_Response.json", "items.id", "items.etag");
+ .AssertJsonFromResource("RefDataGetNamed_Response.json", "gender.id", "gender.etag", "gender.entitykey");
}
}
\ No newline at end of file
diff --git a/samples/My.Hr/My.Hr.Test/My.Hr.Test.csproj b/samples/My.Hr/My.Hr.Test/My.Hr.Test.csproj
index db4afa995..9ffb2bdc5 100644
--- a/samples/My.Hr/My.Hr.Test/My.Hr.Test.csproj
+++ b/samples/My.Hr/My.Hr.Test/My.Hr.Test.csproj
@@ -32,13 +32,13 @@
-
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
diff --git a/samples/MyEf.Hr/MyEf.Hr.Api/MyEf.Hr.Api.csproj b/samples/MyEf.Hr/MyEf.Hr.Api/MyEf.Hr.Api.csproj
index d3256b4d4..42d61c7dd 100644
--- a/samples/MyEf.Hr/MyEf.Hr.Api/MyEf.Hr.Api.csproj
+++ b/samples/MyEf.Hr/MyEf.Hr.Api/MyEf.Hr.Api.csproj
@@ -6,8 +6,8 @@
True
-
-
+
+
diff --git a/samples/MyEf.Hr/MyEf.Hr.Business/MyEf.Hr.Business.csproj b/samples/MyEf.Hr/MyEf.Hr.Business/MyEf.Hr.Business.csproj
index 25a4e0826..8c3b00789 100644
--- a/samples/MyEf.Hr/MyEf.Hr.Business/MyEf.Hr.Business.csproj
+++ b/samples/MyEf.Hr/MyEf.Hr.Business/MyEf.Hr.Business.csproj
@@ -5,10 +5,10 @@
true
-
-
-
-
+
+
+
+
diff --git a/samples/MyEf.Hr/MyEf.Hr.Common/Agents/Generated/ReferenceDataAgent.cs b/samples/MyEf.Hr/MyEf.Hr.Common/Agents/Generated/ReferenceDataAgent.cs
index 2dad6add1..7ee22a74d 100644
--- a/samples/MyEf.Hr/MyEf.Hr.Common/Agents/Generated/ReferenceDataAgent.cs
+++ b/samples/MyEf.Hr/MyEf.Hr.Common/Agents/Generated/ReferenceDataAgent.cs
@@ -35,24 +35,24 @@ public ReferenceDataAgent(HttpClient client, IJsonSerializer jsonSerializer, Cor
: base(client, jsonSerializer, executionContext, settings, logger) { }
///
- public Task> GenderGetAllAsync(ReferenceDataFilter? args = null, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default) =>
- GetAsync("ref/genders", requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg("args", args!, HttpArgType.FromUriUseProperties)), cancellationToken);
+ public Task> GenderGetAllAsync(ReferenceDataFilter? args = null, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default)
+ => GetAsync("ref/genders", requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg("args", args!, HttpArgType.FromUriUseProperties)), cancellationToken);
///
- public Task> TerminationReasonGetAllAsync(ReferenceDataFilter? args = null, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default) =>
- GetAsync("ref/terminationreasons", requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg("args", args!, HttpArgType.FromUriUseProperties)), cancellationToken);
+ public Task> TerminationReasonGetAllAsync(ReferenceDataFilter? args = null, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default)
+ => GetAsync("ref/terminationreasons", requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg("args", args!, HttpArgType.FromUriUseProperties)), cancellationToken);
///
- public Task> RelationshipTypeGetAllAsync(ReferenceDataFilter? args = null, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default) =>
- GetAsync("ref/relationshiptypes", requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg("args", args!, HttpArgType.FromUriUseProperties)), cancellationToken);
+ public Task> RelationshipTypeGetAllAsync(ReferenceDataFilter? args = null, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default)
+ => GetAsync("ref/relationshiptypes", requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg("args", args!, HttpArgType.FromUriUseProperties)), cancellationToken);
///
- public Task> USStateGetAllAsync(ReferenceDataFilter? args = null, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default) =>
- GetAsync("ref/usstates", requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg("args", args!, HttpArgType.FromUriUseProperties)), cancellationToken);
+ public Task> USStateGetAllAsync(ReferenceDataFilter? args = null, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default)
+ => GetAsync("ref/usstates", requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg("args", args!, HttpArgType.FromUriUseProperties)), cancellationToken);
///
- public Task> PerformanceOutcomeGetAllAsync(ReferenceDataFilter? args = null, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default) =>
- GetAsync("ref/performanceoutcomes", requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg("args", args!, HttpArgType.FromUriUseProperties)), cancellationToken);
+ public Task> PerformanceOutcomeGetAllAsync(ReferenceDataFilter? args = null, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default)
+ => GetAsync("ref/performanceoutcomes", requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg("args", args!, HttpArgType.FromUriUseProperties)), cancellationToken);
///
public Task GetNamedAsync(string[] names, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default)
diff --git a/samples/MyEf.Hr/MyEf.Hr.Common/MyEf.Hr.Common.csproj b/samples/MyEf.Hr/MyEf.Hr.Common/MyEf.Hr.Common.csproj
index 42e682af7..3cb51503f 100644
--- a/samples/MyEf.Hr/MyEf.Hr.Common/MyEf.Hr.Common.csproj
+++ b/samples/MyEf.Hr/MyEf.Hr.Common/MyEf.Hr.Common.csproj
@@ -4,6 +4,6 @@
enable
-
+
\ No newline at end of file
diff --git a/samples/MyEf.Hr/MyEf.Hr.Security.Subscriptions/MyEf.Hr.Security.Subscriptions.csproj b/samples/MyEf.Hr/MyEf.Hr.Security.Subscriptions/MyEf.Hr.Security.Subscriptions.csproj
index 2b95bf3c8..41ad2a62e 100644
--- a/samples/MyEf.Hr/MyEf.Hr.Security.Subscriptions/MyEf.Hr.Security.Subscriptions.csproj
+++ b/samples/MyEf.Hr/MyEf.Hr.Security.Subscriptions/MyEf.Hr.Security.Subscriptions.csproj
@@ -16,8 +16,8 @@
-
-
+
+
diff --git a/samples/MyEf.Hr/MyEf.Hr.Security.Test/MyEf.Hr.Security.Test.csproj b/samples/MyEf.Hr/MyEf.Hr.Security.Test/MyEf.Hr.Security.Test.csproj
index 7a14bc100..b8ed1de0e 100644
--- a/samples/MyEf.Hr/MyEf.Hr.Security.Test/MyEf.Hr.Security.Test.csproj
+++ b/samples/MyEf.Hr/MyEf.Hr.Security.Test/MyEf.Hr.Security.Test.csproj
@@ -28,7 +28,7 @@
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
diff --git a/samples/MyEf.Hr/MyEf.Hr.Test/Apis/ReferenceDataTest.cs b/samples/MyEf.Hr/MyEf.Hr.Test/Apis/ReferenceDataTest.cs
index edd33511b..d9ca8033e 100644
--- a/samples/MyEf.Hr/MyEf.Hr.Test/Apis/ReferenceDataTest.cs
+++ b/samples/MyEf.Hr/MyEf.Hr.Test/Apis/ReferenceDataTest.cs
@@ -32,6 +32,6 @@ public void A130_GetNamed()
Agent()
.Run(a => a.GetNamedAsync(new string[] { "Gender" }))
.AssertOK()
- .AssertJsonFromResource("RefDataGetNamed_Response.json", "items.id", "items.etag");
+ .AssertJsonFromResource("RefDataGetNamed_Response.json", "gender.id", "gender.etag", "gender.entitykey");
}
}
\ No newline at end of file
diff --git a/samples/MyEf.Hr/MyEf.Hr.Test/MyEf.Hr.Test.csproj b/samples/MyEf.Hr/MyEf.Hr.Test/MyEf.Hr.Test.csproj
index 5ed2a24a8..43b609cec 100644
--- a/samples/MyEf.Hr/MyEf.Hr.Test/MyEf.Hr.Test.csproj
+++ b/samples/MyEf.Hr/MyEf.Hr.Test/MyEf.Hr.Test.csproj
@@ -32,13 +32,13 @@
-
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
diff --git a/templates/Beef.Template.Solution/content/.template.config/template.json b/templates/Beef.Template.Solution/content/.template.config/template.json
index 92f2ecbed..5ed42d0dd 100644
--- a/templates/Beef.Template.Solution/content/.template.config/template.json
+++ b/templates/Beef.Template.Solution/content/.template.config/template.json
@@ -65,7 +65,7 @@
"type": "generated",
"generator": "constant",
"parameters": {
- "value": "3.7.2"
+ "value": "3.8.1"
},
"replaces": "CoreExVersion"
},
@@ -73,7 +73,7 @@
"type": "generated",
"generator": "constant",
"parameters": {
- "value": "5.7.4"
+ "value": "5.8.0"
},
"replaces": "BeefVersion"
},
diff --git a/templates/Beef.Template.Solution/content/Company.AppName.CodeGen/refdata.beef-5.yaml b/templates/Beef.Template.Solution/content/Company.AppName.CodeGen/refdata.beef-5.yaml
index f4d498baf..8faddfdce 100644
--- a/templates/Beef.Template.Solution/content/Company.AppName.CodeGen/refdata.beef-5.yaml
+++ b/templates/Beef.Template.Solution/content/Company.AppName.CodeGen/refdata.beef-5.yaml
@@ -1,4 +1,4 @@
-webapiRoutePrefix: ref
+webApiRoutePrefix: ref
//#if (implement_database)
autoImplement: Database
refDataType: Guid
diff --git a/tools/Beef.CodeGen.Core/Beef.CodeGen.Core.csproj b/tools/Beef.CodeGen.Core/Beef.CodeGen.Core.csproj
index 31a034f6e..6cbd19938 100644
--- a/tools/Beef.CodeGen.Core/Beef.CodeGen.Core.csproj
+++ b/tools/Beef.CodeGen.Core/Beef.CodeGen.Core.csproj
@@ -31,8 +31,8 @@
-
-
+
+
diff --git a/tools/Beef.CodeGen.Core/Config/Database/CodeGenConfig.cs b/tools/Beef.CodeGen.Core/Config/Database/CodeGenConfig.cs
index 7f282def4..ff20ebf31 100644
--- a/tools/Beef.CodeGen.Core/Config/Database/CodeGenConfig.cs
+++ b/tools/Beef.CodeGen.Core/Config/Database/CodeGenConfig.cs
@@ -4,7 +4,6 @@
using DbEx.DbSchema;
using DbEx.Migration;
using Microsoft.Extensions.Logging;
-using Newtonsoft.Json;
using OnRamp;
using OnRamp.Config;
using OnRamp.Utility;
@@ -13,6 +12,7 @@
using System.Diagnostics;
using System.Linq;
using System.Text;
+using System.Text.Json.Serialization;
using System.Threading.Tasks;
namespace Beef.CodeGen.Config.Database
@@ -20,7 +20,6 @@ namespace Beef.CodeGen.Config.Database
///
/// Represents the global database code-generation configuration.
///
- [JsonObject(MemberSerialization = MemberSerialization.OptIn)]
[CodeGenClass("CodeGeneration", Title = "'CodeGeneration' object (database-driven)",
Description = "The `CodeGeneration` object defines global properties that are used to drive the underlying database-driven code generation.",
Markdown = "")]
@@ -39,7 +38,7 @@ public class CodeGenConfig : ConfigRootBase, ISpecialColumnNames
///
/// Gets or sets the name of the `Schema` where the artefacts are defined in the database.
///
- [JsonProperty("schema", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("schema")]
[CodeGenProperty("Key", Title = "The name of the `Schema` where the artefacts are defined in, or should be created in, the database.", IsImportant = true,
Description = "This is used as the default `Schema` for all child objects.")]
public string? Schema { get; set; }
@@ -51,7 +50,7 @@ public class CodeGenConfig : ConfigRootBase, ISpecialColumnNames
///
/// Gets or sets the column name for the `IsDeleted` capability.
///
- [JsonProperty("columnNameIsDeleted", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("columnNameIsDeleted")]
[CodeGenProperty("Infer", Title = "The column name for the `IsDeleted` capability.",
Description = "Defaults to `IsDeleted`.")]
public string? ColumnNameIsDeleted { get; set; }
@@ -59,7 +58,7 @@ public class CodeGenConfig : ConfigRootBase, ISpecialColumnNames
///
/// Gets or sets the column name for the `TenantId` capability.
///
- [JsonProperty("columnNameTenantId", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("columnNameTenantId")]
[CodeGenProperty("Infer", Title = "The column name for the `TenantId` capability.",
Description = "Defaults to `TenantId`.")]
public string? ColumnNameTenantId { get; set; }
@@ -67,7 +66,7 @@ public class CodeGenConfig : ConfigRootBase, ISpecialColumnNames
///
/// Gets or sets the column name for the `OrgUnitId` capability.
///
- [JsonProperty("columnNameOrgUnitId", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("columnNameOrgUnitId")]
[CodeGenProperty("Infer", Title = "The column name for the `OrgUnitId` capability.",
Description = "Defaults to `OrgUnitId`.")]
public string? ColumnNameOrgUnitId { get; set; }
@@ -75,7 +74,7 @@ public class CodeGenConfig : ConfigRootBase, ISpecialColumnNames
///
/// Gets or sets the column name for the `RowVersion` capability.
///
- [JsonProperty("columnNameRowVersion", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("columnNameRowVersion")]
[CodeGenProperty("Infer", Title = "The column name for the `RowVersion` capability.",
Description = "Defaults to `RowVersion`.")]
public string? ColumnNameRowVersion { get; set; }
@@ -83,7 +82,7 @@ public class CodeGenConfig : ConfigRootBase, ISpecialColumnNames
///
/// Gets or sets the column name for the `CreatedBy` capability.
///
- [JsonProperty("columnNameCreatedBy", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("columnNameCreatedBy")]
[CodeGenProperty("Infer", Title = "The column name for the `CreatedBy` capability.",
Description = "Defaults to `CreatedBy`.")]
public string? ColumnNameCreatedBy { get; set; }
@@ -91,7 +90,7 @@ public class CodeGenConfig : ConfigRootBase, ISpecialColumnNames
///
/// Gets or sets the column name for the `CreatedDate` capability.
///
- [JsonProperty("columnNameCreatedDate", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("columnNameCreatedDate")]
[CodeGenProperty("Infer", Title = "The column name for the `CreatedDate` capability.",
Description = "Defaults to `CreatedDate`.")]
public string? ColumnNameCreatedDate { get; set; }
@@ -99,7 +98,7 @@ public class CodeGenConfig : ConfigRootBase, ISpecialColumnNames
///
/// Gets or sets the column name for the `UpdatedBy` capability.
///
- [JsonProperty("columnNameUpdatedBy", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("columnNameUpdatedBy")]
[CodeGenProperty("Infer", Title = "The column name for the `UpdatedBy` capability.",
Description = "Defaults to `UpdatedBy`.")]
public string? ColumnNameUpdatedBy { get; set; }
@@ -107,7 +106,7 @@ public class CodeGenConfig : ConfigRootBase, ISpecialColumnNames
///
/// Gets or sets the column name for the `UpdatedDate` capability.
///
- [JsonProperty("columnNameUpdatedDate", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("columnNameUpdatedDate")]
[CodeGenProperty("Infer", Title = "The column name for the `UpdatedDate` capability.",
Description = "Defaults to `UpdatedDate`.")]
public string? ColumnNameUpdatedDate { get; set; }
@@ -115,7 +114,7 @@ public class CodeGenConfig : ConfigRootBase, ISpecialColumnNames
///
/// Gets or sets the column name for the `DeletedBy` capability.
///
- [JsonProperty("columnNameDeletedBy", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("columnNameDeletedBy")]
[CodeGenProperty("Infer", Title = "The column name for the `DeletedBy` capability.",
Description = "Defaults to `UpdatedBy`.")]
public string? ColumnNameDeletedBy { get; set; }
@@ -123,7 +122,7 @@ public class CodeGenConfig : ConfigRootBase, ISpecialColumnNames
///
/// Gets or sets the column name for the `DeletedDate` capability.
///
- [JsonProperty("columnNameDeletedDate", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("columnNameDeletedDate")]
[CodeGenProperty("Infer", Title = "The column name for the `DeletedDate` capability.",
Description = "Defaults to `UpdatedDate`.")]
public string? ColumnNameDeletedDate { get; set; }
@@ -131,7 +130,7 @@ public class CodeGenConfig : ConfigRootBase, ISpecialColumnNames
///
/// Gets or sets the SQL table or function that is to be used to join against for security-based `OrgUnitId` verification.
///
- [JsonProperty("orgUnitJoinSql", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("orgUnitJoinSql")]
[CodeGenProperty("Infer", Title = "The SQL table or function that is to be used to join against for security-based `OrgUnitId` verification.",
Description = "Defaults to `[Sec].[fnGetUserOrgUnits]()`.")]
public string? OrgUnitJoinSql { get; set; }
@@ -139,7 +138,7 @@ public class CodeGenConfig : ConfigRootBase, ISpecialColumnNames
///
/// Gets or sets the SQL stored procedure that is to be used for `Permission` verification.
///
- [JsonProperty("checkUserPermissionSql", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("checkUserPermissionSql")]
[CodeGenProperty("Infer", Title = "The SQL stored procedure that is to be used for `Permission` verification.",
Description = "Defaults to `[Sec].[spCheckUserHasPermission]`.")]
public string? CheckUserPermissionSql { get; set; }
@@ -147,7 +146,7 @@ public class CodeGenConfig : ConfigRootBase, ISpecialColumnNames
///
/// Gets or sets the SQL function that is to be used for `Permission` verification.
///
- [JsonProperty("getUserPermissionSql", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("getUserPermissionSql")]
[CodeGenProperty("Infer", Title = "The SQL function that is to be used for `Permission` verification.",
Description = "Defaults to `[Sec].[fnGetUserHasPermission]`.")]
public string? GetUserPermissionSql { get; set; }
@@ -159,7 +158,7 @@ public class CodeGenConfig : ConfigRootBase, ISpecialColumnNames
///
/// Gets or sets the option to automatically rename the SQL Tables and Columns for use in .NET.
///
- [JsonProperty("autoDotNetRename", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("autoDotNetRename")]
[CodeGenProperty("DotNet", Title = "The option to automatically rename the SQL Tables and Columns for use in .NET.", Options = new string[] { "None", "PascalCase", "SnakeKebabToPascalCase" },
Description = "Defaults `SnakeKebabToPascalCase` that will remove any underscores or hyphens separating each word and capitalize the first character of each; e.g. `internal-customer_id` would be renamed as `InternalCustomerId`. The `PascalCase` option will capatilize the first character only.")]
public string? AutoDotNetRename { get; set; }
@@ -167,7 +166,7 @@ public class CodeGenConfig : ConfigRootBase, ISpecialColumnNames
///
/// Indicates whether to use preprocessor directives in the generated output.
///
- [JsonProperty("preprocessorDirectives", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("preprocessorDirectives")]
[CodeGenProperty("DotNet", Title = "Indicates whether to use preprocessor directives in the generated output.")]
public bool? PreprocessorDirectives { get; set; }
@@ -178,7 +177,7 @@ public class CodeGenConfig : ConfigRootBase, ISpecialColumnNames
///
/// Indicates whether an `Entity Framework` .NET (C#) model is to be generated.
///
- [JsonProperty("efModel", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("efModel")]
[CodeGenProperty("EntityFramework", Title = "Indicates whether an `Entity Framework` .NET (C#) model is to be generated for all tables.",
Description = "This can be overridden within the `Table`(s).")]
public bool? EfModel { get; set; }
@@ -190,7 +189,7 @@ public class CodeGenConfig : ConfigRootBase, ISpecialColumnNames
///
/// Indicates whether to generate the event outbox SQL and .NET artefacts.
///
- [JsonProperty("outbox", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("outbox")]
[CodeGenProperty("Outbox", Title = "Indicates whether to generate the event outbox SQL and .NET artefacts.",
Description = "Defaults to `false`.")]
public bool? Outbox { get; set; }
@@ -198,7 +197,7 @@ public class CodeGenConfig : ConfigRootBase, ISpecialColumnNames
///
/// Gets or sets the schema name of the event outbox table.
///
- [JsonProperty("outboxSchema", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("outboxSchema")]
[CodeGenProperty("Outbox", Title = "The schema name of the event outbox table.",
Description = "Defaults to `Outbox` (literal).")]
public string? OutboxSchema { get; set; }
@@ -206,7 +205,7 @@ public class CodeGenConfig : ConfigRootBase, ISpecialColumnNames
///
/// Indicates whether to create the `Outbox`-Schema within the database.
///
- [JsonProperty("outboxSchemaCreate", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("outboxSchemaCreate")]
[CodeGenProperty("Outbox", Title = "Indicates whether to create the `OutboxSchema` within the database.",
Description = "Defaults to `true`.")]
public bool? OutboxSchemaCreate { get; set; }
@@ -214,7 +213,7 @@ public class CodeGenConfig : ConfigRootBase, ISpecialColumnNames
///
/// Gets or sets the name of the event outbox table.
///
- [JsonProperty("outboxTable", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("outboxTable")]
[CodeGenProperty("Outbox", Title = "The name of the event outbox table.",
Description = "Defaults to `EventOutbox` (literal).")]
public string? OutboxTable { get; set; }
@@ -222,7 +221,7 @@ public class CodeGenConfig : ConfigRootBase, ISpecialColumnNames
///
/// Gets or sets the stored procedure name for the event outbox enqueue.
///
- [JsonProperty("outboxEnqueueStoredProcedure", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("outboxEnqueueStoredProcedure")]
[CodeGenProperty("Outbox", Title = "The stored procedure name for the event outbox enqueue.",
Description = "Defaults to `spEventOutboxEnqueue` (literal).")]
public string? OutboxEnqueueStoredProcedure { get; set; }
@@ -230,7 +229,7 @@ public class CodeGenConfig : ConfigRootBase, ISpecialColumnNames
///
/// Gets or sets the stored procedure name for the event outbox dequeue.
///
- [JsonProperty("outboxDequeueStoredProcedure", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("outboxDequeueStoredProcedure")]
[CodeGenProperty("Outbox", Title = "The stored procedure name for the event outbox dequeue.",
Description = "Defaults to `spEventOutboxDequeue` (literal).")]
public string? OutboxDequeueStoredProcedure { get; set; }
@@ -242,7 +241,7 @@ public class CodeGenConfig : ConfigRootBase, ISpecialColumnNames
///
/// Gets or sets the base path (directory) prefix for the artefacts.
///
- [JsonProperty("pathBase", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("pathBase")]
[CodeGenProperty("Path", Title = "The base path (directory) prefix for the Database-related artefacts; other `Path*` properties append to this value when they are not specifically overridden.",
Description = "Defaults to `Company` (runtime parameter) + `.` + `AppName` (runtime parameter). For example `Beef.Demo`.")]
public string? PathBase { get; set; }
@@ -250,7 +249,7 @@ public class CodeGenConfig : ConfigRootBase, ISpecialColumnNames
///
/// Gets or sets the path (directory) for the Schema Database-related artefacts.
///
- [JsonProperty("pathDatabaseSchema", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("pathDatabaseSchema")]
[CodeGenProperty("Path", Title = "The path (directory) for the Schema Database-related artefacts.",
Description = "Defaults to `PathBase` + `.Database/Schema` (literal). For example `Beef.Demo.Database/Schema`.")]
public string? PathDatabaseSchema { get; set; }
@@ -258,7 +257,7 @@ public class CodeGenConfig : ConfigRootBase, ISpecialColumnNames
///
/// Gets or sets the path (directory) for the Schema Database-related artefacts.
///
- [JsonProperty("pathDatabaseMigrations", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("pathDatabaseMigrations")]
[CodeGenProperty("Path", Title = "The path (directory) for the Schema Database-related artefacts.",
Description = "Defaults to `PathBase` + `.Database/Migrations` (literal). For example `Beef.Demo.Database/Migrations`.")]
public string? PathDatabaseMigrations { get; set; }
@@ -266,7 +265,7 @@ public class CodeGenConfig : ConfigRootBase, ISpecialColumnNames
///
/// Gets or sets the path (directory) for the Business-related (.NET) artefacts.
///
- [JsonProperty("pathBusiness", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("pathBusiness")]
[CodeGenProperty("Path", Title = "The path (directory) for the Business-related (.NET) artefacts.",
Description = "Defaults to `PathBase` + `.Business` (literal). For example `Beef.Demo.Business`.")]
public string? PathBusiness { get; set; }
@@ -278,7 +277,7 @@ public class CodeGenConfig : ConfigRootBase, ISpecialColumnNames
///
/// Indicates whether the `OrgUnitId` column is considered immutable, in that it can not be changed once set.
///
- [JsonProperty("orgUnitImmutable", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("orgUnitImmutable")]
[CodeGenProperty("Auth", Title = "Indicates whether the `OrgUnitId` column is considered immutable, in that it can not be changed once set.", IsImportant = true,
Description = "This is only applicable for stored procedures.")]
public bool? OrgUnitImmutable { get; set; }
@@ -290,7 +289,7 @@ public class CodeGenConfig : ConfigRootBase, ISpecialColumnNames
///
/// Gets or sets the base Namespace (root) for the .NET artefacts.
///
- [JsonProperty("namespaceBase", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("namespaceBase")]
[CodeGenProperty("Namespace", Title = "The base Namespace (root) for the .NET artefacts.",
Description = "Defaults to `Company` (runtime parameter) + `.` + `AppName` (runtime parameter). For example `Beef.Demo`.")]
public string? NamespaceBase { get; set; }
@@ -298,7 +297,7 @@ public class CodeGenConfig : ConfigRootBase, ISpecialColumnNames
///
/// Gets or sets the Namespace (root) for the Common-related .NET artefacts.
///
- [JsonProperty("namespaceCommon", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("namespaceCommon")]
[CodeGenProperty("Namespace", Title = "The Namespace (root) for the Common-related .NET artefacts.",
Description = "Defaults to `NamespaceBase` + `.Common` (literal). For example `Beef.Demo.Common`.")]
public string? NamespaceCommon { get; set; }
@@ -306,7 +305,7 @@ public class CodeGenConfig : ConfigRootBase, ISpecialColumnNames
///
/// Gets or sets the Namespace (root) for the Business-related .NET artefacts.
///
- [JsonProperty("namespaceBusiness", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("namespaceBusiness")]
[CodeGenProperty("Namespace", Title = "The Namespace (root) for the Business-related .NET artefacts.",
Description = "Defaults to `NamespaceBase` + `.Business` (literal). For example `Beef.Demo.Business`.")]
public string? NamespaceBusiness { get; set; }
@@ -314,7 +313,7 @@ public class CodeGenConfig : ConfigRootBase, ISpecialColumnNames
///
/// Gets or sets the Namespace (root) for the outbox-related .NET artefacts.
///
- [JsonProperty("namespaceOutbox", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("namespaceOutbox")]
[CodeGenProperty("Namespace", Title = "The Namespace (root) for the Outbox-related Publisher .NET artefacts.",
Description = "Defaults to `NamespaceBusiness`.")]
public string? NamespaceOutbox { get; set; }
@@ -324,7 +323,7 @@ public class CodeGenConfig : ConfigRootBase, ISpecialColumnNames
///
/// Gets or sets the corresponding collection.
///
- [JsonProperty("tables", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("tables")]
[CodeGenPropertyCollection("Collections", Title = "The corresponding `Table` collection.", IsImportant = true,
Markdown = "A `Table` object provides the relationship to an existing table within the database.")]
public List? Tables { get; set; }
@@ -332,7 +331,7 @@ public class CodeGenConfig : ConfigRootBase, ISpecialColumnNames
///
/// Gets or sets the corresponding collection.
///
- [JsonProperty("queries", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("queries")]
[CodeGenPropertyCollection("Collections", Title = "The corresponding `Query` collection.", IsImportant = true,
Markdown = "A `Query` object provides the primary configuration for a query, including multiple table joins.")]
public List? Queries { get; set; }
@@ -494,6 +493,6 @@ internal static void WarnWhereDeprecated(CodeGenConfig root, ConfigBase config,
/// The schema.
/// The table.
/// The formatted name.
- public string? FormatSchemaTableName(string? schema, string? table) => schema != null && schema.Length > 1 ? $"{schema}.{table}" : table;
+ public static string? FormatSchemaTableName(string? schema, string? table) => schema != null && schema.Length > 1 ? $"{schema}.{table}" : table;
}
}
\ No newline at end of file
diff --git a/tools/Beef.CodeGen.Core/Config/Database/EfRelationshipConfig.cs b/tools/Beef.CodeGen.Core/Config/Database/EfRelationshipConfig.cs
index 75d634467..663d0b589 100644
--- a/tools/Beef.CodeGen.Core/Config/Database/EfRelationshipConfig.cs
+++ b/tools/Beef.CodeGen.Core/Config/Database/EfRelationshipConfig.cs
@@ -1,11 +1,11 @@
// Copyright (c) Avanade. Licensed under the MIT License. See https://github.com/Avanade/Beef
using DbEx.DbSchema;
-using Newtonsoft.Json;
using OnRamp;
using OnRamp.Config;
using System.Collections.Generic;
using System.Linq;
+using System.Text.Json.Serialization;
using System.Threading.Tasks;
namespace Beef.CodeGen.Config.Database
@@ -13,7 +13,6 @@ namespace Beef.CodeGen.Config.Database
///
/// Represents a database entity framework (EF) relationship configuration.
///
- [JsonObject(MemberSerialization = MemberSerialization.OptIn)]
[CodeGenClass("Relationship", Title = "'Relationship' object (database-driven)",
Description = "The `Relationship` object enables the definition of an entity framework (EF) model relationship.")]
[CodeGenCategory("Key", Title = "Provides the _key_ configuration.")]
@@ -26,14 +25,14 @@ public class EfRelationshipConfig : ConfigBase, ITab
///
/// Gets or sets the related table name.
///
- [JsonProperty("name", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("name")]
[CodeGenProperty("Key", Title = "The name of the primary table of the query.", IsMandatory = true, IsImportant = true)]
public string? Name { get; set; }
///
/// Gets or sets the related schema name.
///
- [JsonProperty("schema", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("schema")]
[CodeGenProperty("Key", Title = "The schema name of the primary table of the view.",
Description = "Defaults to `CodeGeneration.Schema`.")]
public string? Schema { get; set; }
@@ -41,7 +40,7 @@ public class EfRelationshipConfig : ConfigBase, ITab
///
/// Gets or sets the relationship type.
///
- [JsonProperty("type", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("type")]
[CodeGenProperty("Key", Title = "The relationship type between the parent and child (self).", IsImportant = true, Options = new string[] { "OneToMany", "ManyToOne" },
Description = "Defaults to `OneToMany`.")]
public string? Type { get; set; }
@@ -49,14 +48,14 @@ public class EfRelationshipConfig : ConfigBase, ITab
///
/// Gets or sets the list of `Column` names from the related table that reference the parent.
///
- [JsonProperty("foreignKeyColumns", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("foreignKeyColumns")]
[CodeGenPropertyCollection("Key", Title = "The list of `Column` names from the related table that reference the parent.", IsMandatory = true, IsImportant = true)]
public List? ForeignKeyColumns { get; set; }
///
/// Gets or sets the list of `Column` names from the principal table that reference the child.
///
- [JsonProperty("principalKeyColumns", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("principalKeyColumns")]
[CodeGenPropertyCollection("Key", Title = "The list of `Column` names from the principal table that reference the child.",
Description = " Typically this is only used where referencing property(s) other than the primary key as the principal property(s).")]
public List? PrincipalKeyColumns { get; set; }
@@ -68,7 +67,7 @@ public class EfRelationshipConfig : ConfigBase, ITab
///
/// Gets or sets the operation applied on delete.
///
- [JsonProperty("onDelete", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("onDelete")]
[CodeGenProperty("EF", Title = "The operation applied to dependent entities in the relationship when the principal is deleted or the relationship is severed.",
Options = new string[] { "NoAction", "Cascade", "ClientCascade", "ClientNoAction", "ClientSetNull", "Restrict", "SetNull" },
Description = "Defaults to `NoAction`. See https://learn.microsoft.com/en-us/dotnet/api/microsoft.entityframeworkcore.deletebehavior for more information.")]
@@ -77,7 +76,7 @@ public class EfRelationshipConfig : ConfigBase, ITab
///
/// Indicates whether to automatically include navigation to the property.
///
- [JsonProperty("autoInclude", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("autoInclude")]
[CodeGenProperty("EF", Title = "Indicates whether to automatically include navigation to the property.",
Description = "Defaults to `false`.")]
public bool? AutoInclude { get; set; }
@@ -89,7 +88,7 @@ public class EfRelationshipConfig : ConfigBase, ITab
///
/// Gets or sets the corresponding property name within the entity framework (EF) model.
///
- [JsonProperty("propertyName", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("propertyName")]
[CodeGenProperty("DotNet", Title = "The corresponding property name within the entity framework (EF) model.",
Description = "Defaults to `Name` using the `CodeGeneration.AutoDotNetRename` option.")]
public string? PropertyName { get; set; }
@@ -97,7 +96,7 @@ public class EfRelationshipConfig : ConfigBase, ITab
///
/// Gets or sets the corresponding entity framework (EF) model name (.NET Type).
///
- [JsonProperty("efModelName", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("efModelName")]
[CodeGenProperty("DotNet", Title = "The corresponding entity framework (EF) model name (.NET Type).",
Description = "Defaults to `Name` using the `CodeGeneration.AutoDotNetRename` option.")]
public string? EfModelName { get; set; }
@@ -153,7 +152,7 @@ protected override Task PrepareAsync()
Schema = DefaultWhereNull(Schema, () => Root!.Schema);
DbTable = Root!.DbTables!.Where(x => x.Name == Name && x.Schema == Schema).SingleOrDefault();
if (DbTable == null)
- throw new CodeGenException(this, nameof(Name), $"Specified Schema.Table '{Root.FormatSchemaTableName(Schema, Name)}' not found in database.");
+ throw new CodeGenException(this, nameof(Name), $"Specified Schema.Table '{CodeGenConfig.FormatSchemaTableName(Schema, Name)}' not found in database.");
Type = DefaultWhereNull(Type, () => "OneToMany");
PropertyName = DefaultWhereNull(PropertyName, () => Root!.RenameForDotNet(Name));
diff --git a/tools/Beef.CodeGen.Core/Config/Database/ExecuteConfig.cs b/tools/Beef.CodeGen.Core/Config/Database/ExecuteConfig.cs
index fbc8e6b46..93e29e34f 100644
--- a/tools/Beef.CodeGen.Core/Config/Database/ExecuteConfig.cs
+++ b/tools/Beef.CodeGen.Core/Config/Database/ExecuteConfig.cs
@@ -1,7 +1,7 @@
// Copyright (c) Avanade. Licensed under the MIT License. See https://github.com/Avanade/Beef
-using Newtonsoft.Json;
using OnRamp.Config;
+using System.Text.Json.Serialization;
using System.Threading.Tasks;
namespace Beef.CodeGen.Config.Database
@@ -9,7 +9,6 @@ namespace Beef.CodeGen.Config.Database
///
/// Represents the stored procedure additional statement configuration.
///
- [JsonObject(MemberSerialization = MemberSerialization.OptIn)]
[CodeGenClass("Execute", Title = "'Execute' object (database-driven)",
Description = "The _Execute_ object enables additional TSQL statements to be embedded within the stored procedure.",
ExampleMarkdown = @"A YAML example is as follows:
@@ -42,14 +41,14 @@ public class ExecuteConfig : ConfigBase
///
/// Gets or sets the additional TSQL statement.
///
- [JsonProperty("statement", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("statement")]
[CodeGenProperty("Key", Title = "The additional TSQL statement.", IsMandatory = true, IsImportant = true)]
public string? Statement { get; set; }
///
/// Gets or sets the location of the statement in relation to the underlying primary stored procedure statement.
///
- [JsonProperty("location", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("location")]
[CodeGenProperty("Key", Title = "The location of the statement in relation to the underlying primary stored procedure statement.", IsImportant = true, Options = new string[] { "Before", "After" },
Description = "Defaults to `After`.")]
public string? Location { get; set; }
diff --git a/tools/Beef.CodeGen.Core/Config/Database/OrderByConfig.cs b/tools/Beef.CodeGen.Core/Config/Database/OrderByConfig.cs
index 71abaac63..22f5f58e2 100644
--- a/tools/Beef.CodeGen.Core/Config/Database/OrderByConfig.cs
+++ b/tools/Beef.CodeGen.Core/Config/Database/OrderByConfig.cs
@@ -1,8 +1,8 @@
// Copyright (c) Avanade. Licensed under the MIT License. See https://github.com/Avanade/Beef
-using Newtonsoft.Json;
using OnRamp.Config;
using System;
+using System.Text.Json.Serialization;
using System.Threading.Tasks;
namespace Beef.CodeGen.Config.Database
@@ -10,7 +10,6 @@ namespace Beef.CodeGen.Config.Database
///
/// Represents the stored procedure order-by configuration.
///
- [JsonObject(MemberSerialization = MemberSerialization.OptIn)]
[CodeGenClass("OrderBy", Title = "'OrderBy' object (database-driven)",
Description = "The `OrderBy` object defines the query order. Only valid for `StoredProcedure.Type` of `GetAll`.",
ExampleMarkdown = @"A YAML example is as follows:
@@ -49,14 +48,14 @@ public class OrderByConfig : ConfigBase
///
/// Gets or sets the name of the column to order by.
///
- [JsonProperty("name", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("name")]
[CodeGenProperty("Key", Title = "The name of the `Column` to order by.", IsMandatory = true, IsImportant = true)]
public string? Name { get; set; }
///
/// Gets or sets the sort order option.
///
- [JsonProperty("order", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("order")]
[CodeGenProperty("Key", Title = "The corresponding sort order.", IsImportant = true, Options = new string[] { "Ascending", "Descending" },
Description = "Defaults to `Ascending`.")]
public string? Order { get; set; }
diff --git a/tools/Beef.CodeGen.Core/Config/Database/ParameterConfig.cs b/tools/Beef.CodeGen.Core/Config/Database/ParameterConfig.cs
index bbaf57b4a..b9b4d1fe4 100644
--- a/tools/Beef.CodeGen.Core/Config/Database/ParameterConfig.cs
+++ b/tools/Beef.CodeGen.Core/Config/Database/ParameterConfig.cs
@@ -1,12 +1,12 @@
// Copyright (c) Avanade. Licensed under the MIT License. See https://github.com/Avanade/Beef
using DbEx.DbSchema;
-using Newtonsoft.Json;
using OnRamp;
using OnRamp.Config;
using System;
using System.Linq;
using System.Text;
+using System.Text.Json.Serialization;
using System.Threading.Tasks;
namespace Beef.CodeGen.Config.Database
@@ -14,7 +14,6 @@ namespace Beef.CodeGen.Config.Database
///
/// Represents the stored procedure parameter configuration.
///
- [JsonObject(MemberSerialization = MemberSerialization.OptIn)]
[CodeGenClass("Parameter", Title = "'Parameter' object (database-driven)",
Description = "The `Parameter` is used to define a stored procedure parameter and its charateristics. These are in addition to those that are automatically inferred (added) by the selected `StoredProcedure.Type`.",
ExampleMarkdown = @"A YAML example is as follows:
@@ -53,14 +52,14 @@ public class ParameterConfig : ConfigBase
///
/// Gets or sets the parameter name (without the `@` prefix).
///
- [JsonProperty("name", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("name")]
[CodeGenProperty("Key", Title = "The parameter name (without the `@` prefix).", IsMandatory = true, IsImportant = true)]
public string? Name { get; set; }
///
/// Gets or sets the corresponding column name; used to infer characteristics.
///
- [JsonProperty("column", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("column")]
[CodeGenProperty("Key", Title = "The corresponding column name; used to infer characteristics.",
Description = "Defaults to `Name`.")]
public string? Column { get; set; }
@@ -68,14 +67,14 @@ public class ParameterConfig : ConfigBase
///
/// Gets or sets the SQL type definition (overrides inherited Column definition) including length/precision/scale.
///
- [JsonProperty("sqlType", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("sqlType")]
[CodeGenProperty("Key", Title = "The SQL type definition (overrides inherited Column definition) including length/precision/scale.")]
public string? SqlType { get; set; }
///
/// Indicates whether the parameter is nullable.
///
- [JsonProperty("nullable", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("nullable")]
[CodeGenProperty("Key", Title = "Indicates whether the parameter is nullable.",
Description = "Note that when the parameter value is `NULL` it will not be included in the query.")]
public bool? Nullable { get; set; }
@@ -83,21 +82,21 @@ public class ParameterConfig : ConfigBase
///
/// Indicates whether the column value where NULL should be treated as the specified value; results in: `ISNULL([x].[col], value)`.
///
- [JsonProperty("treatColumnNullAs", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("treatColumnNullAs")]
[CodeGenProperty("Key", Title = "Indicates whether the column value where NULL should be treated as the specified value; results in: `ISNULL([x].[col], value)`.")]
public bool? TreatColumnNullAs { get; set; }
///
/// Indicates whether the parameter is a collection (one or more values to be included `IN` the query).
///
- [JsonProperty("collection", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("collection")]
[CodeGenProperty("Key", Title = "Indicates whether the parameter is a collection (one or more values to be included `IN` the query).")]
public bool? Collection { get; set; }
///
/// Gets or sets the where clause equality operator.
///
- [JsonProperty("operator", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("operator")]
[CodeGenProperty("Key", Title = "The where clause equality operator", IsImportant = true, Options = new string[] { "EQ", "NE", "LT", "LE", "GT", "GE", "LIKE" },
Description = "Defaults to `EQ`.")]
public string? Operator { get; set; }
@@ -154,10 +153,7 @@ protected override Task PrepareAsync()
SqlType = DefaultWhereNull(SqlType, () =>
{
- var c = Parent!.Parent!.Columns.Where(x => x.Name == Column).SingleOrDefault()?.DbColumn;
- if (c == null)
- throw new CodeGenException(this, nameof(Column), $"Column '{Column}' (Schema.Table '{Parent!.Parent!.Schema}.{Parent!.Parent!.Name}') not found in database.");
-
+ var c = (Parent!.Parent!.Columns.Where(x => x.Name == Column).SingleOrDefault()?.DbColumn) ?? throw new CodeGenException(this, nameof(Column), $"Column '{Column}' (Schema.Table '{Parent!.Parent!.Schema}.{Parent!.Parent!.Name}') not found in database.");
var sb = new StringBuilder();
if (CompareValue(Collection, true))
{
diff --git a/tools/Beef.CodeGen.Core/Config/Database/QueryConfig.cs b/tools/Beef.CodeGen.Core/Config/Database/QueryConfig.cs
index d1e397f95..f0824a740 100644
--- a/tools/Beef.CodeGen.Core/Config/Database/QueryConfig.cs
+++ b/tools/Beef.CodeGen.Core/Config/Database/QueryConfig.cs
@@ -1,13 +1,13 @@
// Copyright (c) Avanade. Licensed under the MIT License. See https://github.com/Avanade/Beef
using DbEx.DbSchema;
-using Newtonsoft.Json;
using OnRamp;
using OnRamp.Config;
using OnRamp.Utility;
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Text.Json.Serialization;
using System.Threading.Tasks;
namespace Beef.CodeGen.Config.Database
@@ -15,7 +15,6 @@ namespace Beef.CodeGen.Config.Database
///
/// Represents a database query configuration.
///
- [JsonObject(MemberSerialization = MemberSerialization.OptIn)]
[CodeGenClass("Query", Title = "'Query' object (database-driven)",
Description = "The `Query` object enables the definition of more complex multi-table queries (`Joins`) that would primarily result in a database _View_. The primary table `Name` for the query is required to be specified. Multiple queries can be specified for the same table(s)."
+ " The `IncludeColumns` and `ExcludeColumns` provide a shorthand to include or exclude selected columns; with the `AliasColumns` providing a means to rename where required (for example duplicate name)."
@@ -52,14 +51,14 @@ public class QueryConfig : ConfigBase, ITableRefer
///
/// Gets or sets the name of the primary table of the query.
///
- [JsonProperty("name", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("name")]
[CodeGenProperty("Key", Title = "The name of the primary table of the query.", IsMandatory = true, IsImportant = true)]
public string? Name { get; set; }
///
/// Gets or sets the schema name of the primary table of the view.
///
- [JsonProperty("schema", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("schema")]
[CodeGenProperty("Key", Title = "The schema name of the primary table of the view.",
Description = "Defaults to `CodeGeneration.Schema`.")]
public string? Schema { get; set; }
@@ -67,7 +66,7 @@ public class QueryConfig : ConfigBase, ITableRefer
///
/// Gets or sets the `Schema.Table` alias name.
///
- [JsonProperty("alias", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("alias")]
[CodeGenProperty("Key", Title = "The `Schema.Table` alias name.",
Description = "Will automatically default where not specified.")]
public string? Alias { get; set; }
@@ -79,7 +78,7 @@ public class QueryConfig : ConfigBase, ITableRefer
///
/// Gets or sets the list of `Column` names to be included in the underlying generated output.
///
- [JsonProperty("includeColumns", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("includeColumns")]
[CodeGenPropertyCollection("Columns", Title = "The list of `Column` names to be included in the underlying generated output.", IsImportant = true,
Description = "Where not specified this indicates that all `Columns` are to be included.")]
public List? IncludeColumns { get; set; }
@@ -87,7 +86,7 @@ public class QueryConfig : ConfigBase, ITableRefer
///
/// Gets or sets the list of `Column` names to be excluded from the underlying generated output.
///
- [JsonProperty("excludeColumns", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("excludeColumns")]
[CodeGenPropertyCollection("Columns", Title = "The list of `Column` names to be excluded from the underlying generated output.", IsImportant = true,
Description = "Where not specified this indicates no `Columns` are to be excluded.")]
public List? ExcludeColumns { get; set; }
@@ -95,7 +94,7 @@ public class QueryConfig : ConfigBase, ITableRefer
///
/// Gets or sets the list of `Column` and `Alias` pairs to enable column renaming.
///
- [JsonProperty("aliasColumns", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("aliasColumns")]
[CodeGenPropertyCollection("Columns", Title = "The list of `Column` and `Alias` pairs (split by a `^` lookup character) to enable column aliasing/renaming.", IsImportant = true,
Description = "Each alias value should be formatted as `Column` + `^` + `Alias`; e.g. `PCODE^ProductCode`")]
public List? AliasColumns { get; set; }
@@ -107,14 +106,14 @@ public class QueryConfig : ConfigBase, ITableRefer
///
/// Indicates whether a `View` is to be generated.
///
- [JsonProperty("view", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("view")]
[CodeGenProperty("View", Title = "Indicates whether a `View` is to be generated.")]
public bool? View { get; set; }
///
/// Gets or sets the `View` name.
///
- [JsonProperty("viewName", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("viewName")]
[CodeGenProperty("View", Title = "The `View` name.",
Description = "Defaults to `vw` + `Name`; e.g. `vwTableName`.")]
public string? ViewName { get; set; }
@@ -122,7 +121,7 @@ public class QueryConfig : ConfigBase, ITableRefer
///
/// Gets or sets the schema name of the `View`.
///
- [JsonProperty("viewSchema", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("viewSchema")]
[CodeGenProperty("View", Title = "The schema name for the `View`.",
Description = "Defaults to `Schema`.")]
public string? ViewSchema { get; set; }
@@ -134,7 +133,7 @@ public class QueryConfig : ConfigBase, ITableRefer
///
/// Gets or sets the permission to be used for security permission checking.
///
- [JsonProperty("permission", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("permission")]
[CodeGenProperty("Auth", Title = "The permission to be used for security permission checking.", IsImportant = true,
Description = "The suffix is optional, and where not specified will default to `.READ`.")]
public string? Permission { get; set; }
@@ -146,7 +145,7 @@ public class QueryConfig : ConfigBase, ITableRefer
///
/// Gets or sets the column name for the `IsDeleted` capability.
///
- [JsonProperty("columnNameIsDeleted", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("columnNameIsDeleted")]
[CodeGenProperty("Infer", Title = "The column name for the `IsDeleted` capability.",
Description = "Defaults to `CodeGeneration.IsDeleted`.")]
public string? ColumnNameIsDeleted { get; set; }
@@ -154,7 +153,7 @@ public class QueryConfig : ConfigBase, ITableRefer
///
/// Gets or sets the column name for the `TenantId` capability.
///
- [JsonProperty("columnNameTenantId", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("columnNameTenantId")]
[CodeGenProperty("Infer", Title = "The column name for the `TenantId` capability.",
Description = "Defaults to `CodeGeneration.TenantId`.")]
public string? ColumnNameTenantId { get; set; }
@@ -162,7 +161,7 @@ public class QueryConfig : ConfigBase, ITableRefer
///
/// Gets or sets the column name for the `OrgUnitId` capability.
///
- [JsonProperty("columnNameOrgUnitId", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("columnNameOrgUnitId")]
[CodeGenProperty("Infer", Title = "The column name for the `OrgUnitId` capability.",
Description = "Defaults to `CodeGeneration.OrgUnitId`.")]
public string? ColumnNameOrgUnitId { get; set; }
@@ -170,7 +169,7 @@ public class QueryConfig : ConfigBase, ITableRefer
///
/// Gets or sets the column name for the `RowVersion` capability.
///
- [JsonProperty("columnNameRowVersion", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("columnNameRowVersion")]
[CodeGenProperty("Infer", Title = "The column name for the `RowVersion` capability.",
Description = "Defaults to `CodeGeneration.RowVersion`.")]
public string? ColumnNameRowVersion { get; set; }
@@ -178,7 +177,7 @@ public class QueryConfig : ConfigBase, ITableRefer
///
/// Gets or sets the column name for the `CreatedBy` capability.
///
- [JsonProperty("columnNameCreatedBy", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("columnNameCreatedBy")]
[CodeGenProperty("Infer", Title = "The column name for the `CreatedBy` capability.",
Description = "Defaults to `CodeGeneration.CreatedBy`.")]
public string? ColumnNameCreatedBy { get; set; }
@@ -186,7 +185,7 @@ public class QueryConfig : ConfigBase, ITableRefer
///
/// Gets or sets the column name for the `CreatedDate` capability.
///
- [JsonProperty("columnNameCreatedDate", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("columnNameCreatedDate")]
[CodeGenProperty("Infer", Title = "The column name for the `CreatedDate` capability.",
Description = "Defaults to `CodeGeneration.CreatedDate`.")]
public string? ColumnNameCreatedDate { get; set; }
@@ -194,7 +193,7 @@ public class QueryConfig : ConfigBase, ITableRefer
///
/// Gets or sets the column name for the `UpdatedBy` capability.
///
- [JsonProperty("columnNameUpdatedBy", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("columnNameUpdatedBy")]
[CodeGenProperty("Infer", Title = "The column name for the `UpdatedBy` capability.",
Description = "Defaults to `CodeGeneration.UpdatedBy`.")]
public string? ColumnNameUpdatedBy { get; set; }
@@ -202,7 +201,7 @@ public class QueryConfig : ConfigBase, ITableRefer
///
/// Gets or sets the column name for the `UpdatedDate` capability.
///
- [JsonProperty("columnNameUpdatedDate", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("columnNameUpdatedDate")]
[CodeGenProperty("Infer", Title = "The column name for the `UpdatedDate` capability.",
Description = "Defaults to `CodeGeneration.UpdatedDate`.")]
public string? ColumnNameUpdatedDate { get; set; }
@@ -210,7 +209,7 @@ public class QueryConfig : ConfigBase, ITableRefer
///
/// Gets or sets the column name for the `DeletedBy` capability.
///
- [JsonProperty("columnNameDeletedBy", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("columnNameDeletedBy")]
[CodeGenProperty("Infer", Title = "The column name for the `DeletedBy` capability.",
Description = "Defaults to `CodeGeneration.UpdatedBy`.")]
public string? ColumnNameDeletedBy { get; set; }
@@ -218,7 +217,7 @@ public class QueryConfig : ConfigBase, ITableRefer
///
/// Gets or sets the column name for the `DeletedDate` capability.
///
- [JsonProperty("columnNameDeletedDate", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("columnNameDeletedDate")]
[CodeGenProperty("Infer", Title = "The column name for the `DeletedDate` capability.",
Description = "Defaults to `CodeGeneration.UpdatedDate`.")]
public string? ColumnNameDeletedDate { get; set; }
@@ -230,7 +229,7 @@ public class QueryConfig : ConfigBase, ITableRefer
///
/// Gets or sets the corresponding collection.
///
- [JsonProperty("joins", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("joins")]
[CodeGenPropertyCollection("Collections", Title = "The corresponding `Join` collection.", IsImportant = true,
Markdown = "A `Join` object provides the configuration for a joining table.")]
public List? Joins { get; set; }
@@ -238,7 +237,7 @@ public class QueryConfig : ConfigBase, ITableRefer
///
/// Gets or sets the corresponding collection.
///
- [JsonProperty("order", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("order")]
[CodeGenPropertyCollection("Collections", Title = "The corresponding `Order` collection.",
Markdown = "An `Order` object defines the order (sequence).")]
public List? Order { get; set; }
@@ -246,7 +245,7 @@ public class QueryConfig : ConfigBase, ITableRefer
///
/// Gets or sets the corresponding collection.
///
- [JsonProperty("where", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("where")]
[CodeGenPropertyCollection("Collections", Title = "The corresponding `Where` collection.",
Markdown = "A `Where` object defines the selection/filtering.")]
public List? Where { get; set; }
diff --git a/tools/Beef.CodeGen.Core/Config/Database/QueryJoinConfig.cs b/tools/Beef.CodeGen.Core/Config/Database/QueryJoinConfig.cs
index 60ecb6c97..65c922cc0 100644
--- a/tools/Beef.CodeGen.Core/Config/Database/QueryJoinConfig.cs
+++ b/tools/Beef.CodeGen.Core/Config/Database/QueryJoinConfig.cs
@@ -1,13 +1,13 @@
// Copyright (c) Avanade. Licensed under the MIT License. See https://github.com/Avanade/Beef
using DbEx.DbSchema;
-using Newtonsoft.Json;
using OnRamp;
using OnRamp.Config;
using OnRamp.Utility;
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Text.Json.Serialization;
using System.Threading.Tasks;
namespace Beef.CodeGen.Config.Database
@@ -15,7 +15,6 @@ namespace Beef.CodeGen.Config.Database
///
/// Represents the table join configuration.
///
- [JsonObject(MemberSerialization = MemberSerialization.OptIn)]
[CodeGenClass("QueryJoin", Title = "'QueryJoin' object (database-driven)",
Description = "The `QueryJoin` object defines a join to another (or same) table within a query. The `Type` defines the join type, such as inner join, etc."
+ " The `IncludeColumns` and `ExcludeColumns` provide a shorthand to include or exclude selected columns; with the `AliasColumns` providing a means to rename where required (for example duplicate name).",
@@ -48,14 +47,14 @@ public class QueryJoinConfig : ConfigBase, ITableRef
///
/// Gets or sets the name of the table to join.
///
- [JsonProperty("name", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("name")]
[CodeGenProperty("Key", Title = "The name of the table to join.", IsMandatory = true, IsImportant = true)]
public string? Name { get; set; }
///
/// Gets or sets the schema name of the table to join.
///
- [JsonProperty("schema", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("schema")]
[CodeGenProperty("Key", Title = "The schema name of the table to join.",
Description = "Defaults to `Table.Schema`; i.e. same schema.")]
public string? Schema { get; set; }
@@ -63,7 +62,7 @@ public class QueryJoinConfig : ConfigBase, ITableRef
///
/// Gets or sets the `Schema.Table` alias name.
///
- [JsonProperty("alias", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("alias")]
[CodeGenProperty("Key", Title = "The `Schema.Table` alias name.",
Description = "Will automatically default where not specified.")]
public string? Alias { get; set; }
@@ -71,7 +70,7 @@ public class QueryJoinConfig : ConfigBase, ITableRef
///
/// Gets or sets the join type option.
///
- [JsonProperty("type", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("type")]
[CodeGenProperty("Key", Title = "The SQL join type.", IsImportant = true, Options = new string[] { "Inner", "Left", "Right", "Full" },
Description = "Defaults to `Inner`.")]
public string? Type { get; set; }
@@ -83,7 +82,7 @@ public class QueryJoinConfig : ConfigBase, ITableRef
///
/// Gets or sets the list of `Column` names to be included in the underlying generated output.
///
- [JsonProperty("includeColumns", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("includeColumns")]
[CodeGenPropertyCollection("Columns", Title = "The list of `Column` names to be included in the underlying generated output.", IsImportant = true,
Description = "Where not specified this indicates that all `Columns` are to be included.")]
public List? IncludeColumns { get; set; }
@@ -91,7 +90,7 @@ public class QueryJoinConfig : ConfigBase, ITableRef
///
/// Gets or sets the list of `Column` names to be excluded from the underlying generated output.
///
- [JsonProperty("excludeColumns", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("excludeColumns")]
[CodeGenPropertyCollection("Columns", Title = "The list of `Column` names to be excluded from the underlying generated output.", IsImportant = true,
Description = "Where not specified this indicates no `Columns` are to be excluded.")]
public List? ExcludeColumns { get; set; }
@@ -99,7 +98,7 @@ public class QueryJoinConfig : ConfigBase, ITableRef
///
/// Gets or sets the list of `Column` and `Alias` pairs to enable column renaming.
///
- [JsonProperty("aliasColumns", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("aliasColumns")]
[CodeGenPropertyCollection("Columns", Title = "The list of `Column` and `Alias` pairs (split by a `^` lookup character) to enable column renaming.", IsImportant = true,
Description = "Each alias value should be formatted as `Column` + `^` + `Alias`; e.g. `PCODE^ProductCode`")]
public List? AliasColumns { get; set; }
@@ -111,7 +110,7 @@ public class QueryJoinConfig : ConfigBase, ITableRef
///
/// Gets or sets the column name for the `IsDeleted` capability.
///
- [JsonProperty("columnNameIsDeleted", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("columnNameIsDeleted")]
[CodeGenProperty("Infer", Title = "The column name for the `IsDeleted` capability.",
Description = "Defaults to `CodeGeneration.IsDeleted`.")]
public string? ColumnNameIsDeleted { get; set; }
@@ -119,7 +118,7 @@ public class QueryJoinConfig : ConfigBase, ITableRef
///
/// Gets or sets the column name for the `TenantId` capability.
///
- [JsonProperty("columnNameTenantId", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("columnNameTenantId")]
[CodeGenProperty("Infer", Title = "The column name for the `TenantId` capability.",
Description = "Defaults to `CodeGeneration.TenantId`.")]
public string? ColumnNameTenantId { get; set; }
@@ -127,7 +126,7 @@ public class QueryJoinConfig : ConfigBase, ITableRef
///
/// Gets or sets the column name for the `OrgUnitId` capability.
///
- [JsonProperty("columnNameOrgUnitId", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("columnNameOrgUnitId")]
[CodeGenProperty("Infer", Title = "The column name for the `OrgUnitId` capability.",
Description = "Defaults to `CodeGeneration.OrgUnitId`.")]
public string? ColumnNameOrgUnitId { get; set; }
@@ -135,7 +134,7 @@ public class QueryJoinConfig : ConfigBase, ITableRef
///
/// Gets or sets the column name for the `RowVersion` capability.
///
- [JsonProperty("columnNameRowVersion", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("columnNameRowVersion")]
[CodeGenProperty("Infer", Title = "The column name for the `RowVersion` capability.",
Description = "Defaults to `CodeGeneration.RowVersion`.")]
public string? ColumnNameRowVersion { get; set; }
@@ -143,7 +142,7 @@ public class QueryJoinConfig : ConfigBase, ITableRef
///
/// Gets or sets the column name for the `CreatedBy` capability.
///
- [JsonProperty("columnNameCreatedBy", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("columnNameCreatedBy")]
[CodeGenProperty("Infer", Title = "The column name for the `CreatedBy` capability.",
Description = "Defaults to `CodeGeneration.CreatedBy`.")]
public string? ColumnNameCreatedBy { get; set; }
@@ -151,7 +150,7 @@ public class QueryJoinConfig : ConfigBase, ITableRef
///
/// Gets or sets the column name for the `CreatedDate` capability.
///
- [JsonProperty("columnNameCreatedDate", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [JsonPropertyName("columnNameCreatedDate")]
[CodeGenProperty("Infer", Title = "The column name for the `CreatedDate` capability.",
Description = "Defaults to `CodeGeneration.CreatedDate`.")]
public string? ColumnNameCreatedDate { get; set; }
@@ -159,7 +158,7 @@ public class QueryJoinConfig : ConfigBase, ITableRef
///