Skip to content

Commit

Permalink
v5.17.1 (#266)
Browse files Browse the repository at this point in the history
* v5.17.1
- *Fixed:* The database console `Script` command execution has been updated to output to the correct directory path.

* Add global using ExecutionContext in template.

* Agent code-gen simplification.

* Sample tweak.

* *Fixed:* The database code-generation support for replacement is now optional (see new `Replace` property) versus always (defaults to `true`).
  • Loading branch information
chullybun authored Oct 23, 2024
1 parent 82d5380 commit 4f50105
Show file tree
Hide file tree
Showing 82 changed files with 357 additions and 367 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

Represents the **NuGet** versions.

## v5.17.1
- *Fixed:* The database console `Script` command execution has been updated to output to the correct directory path.
- *Fixed:* The `Agent` code-generation artefacts have been further simplified/improved.
- *Fixed:* The database code-generation support for replacement is now optional (see new `Replace` property) versus always (defaults to `true`).

## v5.17.0
- *Enhancement:* The `Common`-project related code-generated artefacts have all been updated to leverage `global using` and file scoped namespace declarations.
- A new [`GlobalUsings.cs`](./templates/Beef.Template.Solution/content/Company.AppName.Common/GlobalUsings.cs) will need to be manually added to existing `Common` projects to enable; see [this](./templates/Beef.Template.Solution/content/Company.AppName.Common/GlobalUsings.cs) for an example and alter the last two namespaces accordingly.
Expand Down
2 changes: 1 addition & 1 deletion Common.targets
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<Version>5.17.0</Version>
<Version>5.17.1</Version>
<LangVersion>preview</LangVersion>
<Authors>Avanade</Authors>
<Company>Avanade</Company>
Expand Down
1 change: 1 addition & 0 deletions docs/Database-Query-Config.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ Property | Description
**`name`** | The name of the primary table of the query. [Mandatory]
`schema` | The schema name of the primary table of the view.<br/>&dagger; Defaults to `CodeGeneration.Schema`.
`alias` | The `Schema.Table` alias name.<br/>&dagger; Will automatically default where not specified.
`viewReplace` | Indicates whether the existing `View` database object should be replaced/altered or whether the object is dropped and recreated.<br/>&dagger; Defaults to `CodeGeneration.Replace`.

<br/>

Expand Down
1 change: 1 addition & 0 deletions docs/Database-StoredProcedure-Config.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ Property | Description
**`type`** | The stored procedure operation type. Valid options are: `Get`, `GetColl`, `Create`, `Update`, `Upsert`, `Delete`, `Merge`.<br/>&dagger; Defaults to `GetColl`.
**`paging`** | Indicates whether standardized paging support should be added.<br/>&dagger; This only applies where the stored procedure operation `Type` is `GetColl`.
`storedProcedureName` | The `StoredProcedure` name in the database.<br/>&dagger; Defaults to `sp` + `Table.Name` + `Name`; e.g. `spTableName` or `spPersonGet`.
`replace` | Indicates whether the existing `StoredProcedure` database object should be replaced/altered or whether the object is dropped and recreated.<br/>&dagger; Defaults to `CodeGeneration.Replace`.

<br/>

Expand Down
1 change: 1 addition & 0 deletions docs/Database-Table-Config.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ Property | Description
**`name`** | The name of the `Table` in the database. [Mandatory]
**`schema`** | The name of the `Schema` where the `Table` is defined in the database.<br/>&dagger; Defaults to `CodeGeneration.Schema`.
`alias` | The `Schema.Table` alias name.<br/>&dagger; Will automatically default where not specified.
`replace` | Indicates whether the existing database object should be replaced/altered or whether the object is dropped and recreated.<br/>&dagger; Defaults to `CodeGeneration.Replace`.

<br/>

Expand Down
2 changes: 1 addition & 1 deletion samples/Cdr.Banking/Cdr.Banking.Api/Cdr.Banking.Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<ImplicitUsings>true</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="CoreEx.AspNetCore" Version="3.27.1" />
<PackageReference Include="CoreEx.AspNetCore" Version="3.27.3" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="6.9.0" />
</ItemGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
<Folder Include="DataSvc\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="CoreEx.AspNetCore" Version="3.27.1" />
<PackageReference Include="CoreEx.Cosmos" Version="3.27.1" />
<PackageReference Include="CoreEx.Validation" Version="3.27.1" />
<PackageReference Include="CoreEx.AspNetCore" Version="3.27.3" />
<PackageReference Include="CoreEx.Cosmos" Version="3.27.3" />
<PackageReference Include="CoreEx.Validation" Version="3.27.3" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,28 @@ namespace Cdr.Banking.Common.Agents;
/// <summary>
/// Provides the <see cref="Account"/> HTTP agent.
/// </summary>
public partial class AccountAgent : TypedHttpClientBase<AccountAgent>, IAccountAgent
/// <param name="client">The underlying <see cref="HttpClient"/>.</param>
/// <param name="jsonSerializer">The optional <see cref="IJsonSerializer"/>.</param>
/// <param name="executionContext">The optional <see cref="CoreEx.ExecutionContext"/>.</param>
public partial class AccountAgent(HttpClient client, IJsonSerializer? jsonSerializer = null, CoreEx.ExecutionContext? executionContext = null) : TypedHttpClientBase<AccountAgent>(client, jsonSerializer, executionContext), IAccountAgent
{
/// <summary>
/// Initializes a new instance of the <see cref="AccountAgent"/> class.
/// </summary>
/// <param name="client">The underlying <see cref="HttpClient"/>.</param>
/// <param name="jsonSerializer">The optional <see cref="IJsonSerializer"/>.</param>
/// <param name="executionContext">The optional <see cref="CoreEx.ExecutionContext"/>.</param>
public AccountAgent(HttpClient client, IJsonSerializer? jsonSerializer = null, CoreEx.ExecutionContext? executionContext = null) : base(client, jsonSerializer, executionContext) { }

/// <inheritdoc/>
public Task<HttpResult<AccountCollectionResult>> GetAccountsAsync(AccountArgs? args, PagingArgs? paging = null, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default)
=> GetAsync<AccountCollectionResult>("api/v1/banking/accounts", requestOptions: requestOptions.IncludePaging(paging), args: HttpArgs.Create(new HttpArg<AccountArgs?>("args", args, HttpArgType.FromUriUseProperties)), cancellationToken: cancellationToken);
=> GetAsync<AccountCollectionResult>("api/v1/banking/accounts", requestOptions.IncludePaging(paging), [new HttpArg<AccountArgs?>("args", args, HttpArgType.FromUriUseProperties)], cancellationToken);

/// <inheritdoc/>
public Task<HttpResult<AccountCollectionResult>> GetAccountsQueryAsync(QueryArgs? query = null, PagingArgs? paging = null, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default)
=> GetAsync<AccountCollectionResult>("api/v1/banking/accounts/query", requestOptions: requestOptions.IncludeQuery(query).IncludePaging(paging), args: HttpArgs.Create(), cancellationToken: cancellationToken);
=> GetAsync<AccountCollectionResult>("api/v1/banking/accounts/query", requestOptions: requestOptions.IncludeQuery(query).IncludePaging(paging), cancellationToken: cancellationToken);

/// <inheritdoc/>
public Task<HttpResult<AccountDetail?>> GetDetailAsync(string? accountId, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default)
=> GetAsync<AccountDetail?>("api/v1/banking/accounts/{accountId}", requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg<string?>("accountId", accountId)), cancellationToken: cancellationToken);
=> GetAsync<AccountDetail?>("api/v1/banking/accounts/{accountId}", requestOptions, [new HttpArg<string?>("accountId", accountId)], cancellationToken);

/// <inheritdoc/>
public Task<HttpResult<Balance?>> GetBalanceAsync(string? accountId, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default)
=> GetAsync<Balance?>("api/v1/banking/accounts/{accountId}/balance", requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg<string?>("accountId", accountId)), cancellationToken: cancellationToken);
=> GetAsync<Balance?>("api/v1/banking/accounts/{accountId}/balance", requestOptions, [new HttpArg<string?>("accountId", accountId)], cancellationToken);

/// <inheritdoc/>
public Task<HttpResult> GetStatementAsync(string? accountId, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default)
=> GetAsync("api/v1/banking/accounts/{accountId}/statement", requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg<string?>("accountId", accountId)), cancellationToken: cancellationToken);
=> GetAsync("api/v1/banking/accounts/{accountId}/statement", requestOptions, [new HttpArg<string?>("accountId", accountId)], cancellationToken);
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,39 +7,34 @@ namespace Cdr.Banking.Common.Agents;
/// <summary>
/// Provides the <b>ReferenceData</b> HTTP agent.
/// </summary>
public partial class ReferenceDataAgent : TypedHttpClientBase<ReferenceDataAgent>, IReferenceDataAgent
/// <param name="client">The underlying <see cref="HttpClient"/>.</param>
/// <param name="jsonSerializer">The optional <see cref="IJsonSerializer"/>.</param>
/// <param name="executionContext">The optional <see cref="CoreEx.ExecutionContext"/>.</param>
public partial class ReferenceDataAgent(HttpClient client, IJsonSerializer? jsonSerializer = null, CoreEx.ExecutionContext? executionContext = null) : TypedHttpClientBase<ReferenceDataAgent>(client, jsonSerializer, executionContext), IReferenceDataAgent
{
/// <summary>
/// Initializes a new instance of the <see cref="ReferenceDataAgent"/> class.
/// </summary>
/// <param name="client">The underlying <see cref="HttpClient"/>.</param>
/// <param name="jsonSerializer">The optional <see cref="IJsonSerializer"/>.</param>
/// <param name="executionContext">The optional <see cref="CoreEx.ExecutionContext"/>.</param>
public ReferenceDataAgent(HttpClient client, IJsonSerializer? jsonSerializer = null, CoreEx.ExecutionContext? executionContext = null) : base(client, jsonSerializer, executionContext) { }

/// <inheritdoc/>
public Task<HttpResult<RefDataNamespace.OpenStatusCollection>> OpenStatusGetAllAsync(ReferenceDataFilter? args = null, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default)
=> GetAsync<RefDataNamespace.OpenStatusCollection>("api/v1/ref/openstatuses", requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg<ReferenceDataFilter>("args", args!, HttpArgType.FromUriUseProperties)), cancellationToken);
=> GetAsync<RefDataNamespace.OpenStatusCollection>("api/v1/ref/openstatuses", requestOptions, [new HttpArg<ReferenceDataFilter?>("args", args, HttpArgType.FromUriUseProperties)], cancellationToken);

/// <inheritdoc/>
public Task<HttpResult<RefDataNamespace.ProductCategoryCollection>> ProductCategoryGetAllAsync(ReferenceDataFilter? args = null, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default)
=> GetAsync<RefDataNamespace.ProductCategoryCollection>("api/v1/ref/productcategories", requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg<ReferenceDataFilter>("args", args!, HttpArgType.FromUriUseProperties)), cancellationToken);
=> GetAsync<RefDataNamespace.ProductCategoryCollection>("api/v1/ref/productcategories", requestOptions, [new HttpArg<ReferenceDataFilter?>("args", args, HttpArgType.FromUriUseProperties)], cancellationToken);

/// <inheritdoc/>
public Task<HttpResult<RefDataNamespace.AccountUTypeCollection>> AccountUTypeGetAllAsync(ReferenceDataFilter? args = null, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default)
=> GetAsync<RefDataNamespace.AccountUTypeCollection>("api/v1/ref/accountutypes", requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg<ReferenceDataFilter>("args", args!, HttpArgType.FromUriUseProperties)), cancellationToken);
=> GetAsync<RefDataNamespace.AccountUTypeCollection>("api/v1/ref/accountutypes", requestOptions, [new HttpArg<ReferenceDataFilter?>("args", args, HttpArgType.FromUriUseProperties)], cancellationToken);

/// <inheritdoc/>
public Task<HttpResult<RefDataNamespace.MaturityInstructionsCollection>> MaturityInstructionsGetAllAsync(ReferenceDataFilter? args = null, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default)
=> GetAsync<RefDataNamespace.MaturityInstructionsCollection>("api/v1/ref/maturityinstructions", requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg<ReferenceDataFilter>("args", args!, HttpArgType.FromUriUseProperties)), cancellationToken);
=> GetAsync<RefDataNamespace.MaturityInstructionsCollection>("api/v1/ref/maturityinstructions", requestOptions, [new HttpArg<ReferenceDataFilter?>("args", args, HttpArgType.FromUriUseProperties)], cancellationToken);

/// <inheritdoc/>
public Task<HttpResult<RefDataNamespace.TransactionTypeCollection>> TransactionTypeGetAllAsync(ReferenceDataFilter? args = null, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default)
=> GetAsync<RefDataNamespace.TransactionTypeCollection>("api/v1/ref/transactiontypes", requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg<ReferenceDataFilter>("args", args!, HttpArgType.FromUriUseProperties)), cancellationToken);
=> GetAsync<RefDataNamespace.TransactionTypeCollection>("api/v1/ref/transactiontypes", requestOptions, [new HttpArg<ReferenceDataFilter?>("args", args, HttpArgType.FromUriUseProperties)], cancellationToken);

/// <inheritdoc/>
public Task<HttpResult<RefDataNamespace.TransactionStatusCollection>> TransactionStatusGetAllAsync(ReferenceDataFilter? args = null, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default)
=> GetAsync<RefDataNamespace.TransactionStatusCollection>("api/v1/ref/transactionstatuses", requestOptions: requestOptions, args: HttpArgs.Create(new HttpArg<ReferenceDataFilter>("args", args!, HttpArgType.FromUriUseProperties)), cancellationToken);
=> GetAsync<RefDataNamespace.TransactionStatusCollection>("api/v1/ref/transactionstatuses", requestOptions, [new HttpArg<ReferenceDataFilter?>("args", args, HttpArgType.FromUriUseProperties)], cancellationToken);

/// <inheritdoc/>
public Task<HttpResult> GetNamedAsync(string[] names, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,12 @@ namespace Cdr.Banking.Common.Agents;
/// <summary>
/// Provides the <see cref="Transaction"/> HTTP agent.
/// </summary>
public partial class TransactionAgent : TypedHttpClientBase<TransactionAgent>, ITransactionAgent
/// <param name="client">The underlying <see cref="HttpClient"/>.</param>
/// <param name="jsonSerializer">The optional <see cref="IJsonSerializer"/>.</param>
/// <param name="executionContext">The optional <see cref="CoreEx.ExecutionContext"/>.</param>
public partial class TransactionAgent(HttpClient client, IJsonSerializer? jsonSerializer = null, CoreEx.ExecutionContext? executionContext = null) : TypedHttpClientBase<TransactionAgent>(client, jsonSerializer, executionContext), ITransactionAgent
{
/// <summary>
/// Initializes a new instance of the <see cref="TransactionAgent"/> class.
/// </summary>
/// <param name="client">The underlying <see cref="HttpClient"/>.</param>
/// <param name="jsonSerializer">The optional <see cref="IJsonSerializer"/>.</param>
/// <param name="executionContext">The optional <see cref="CoreEx.ExecutionContext"/>.</param>
public TransactionAgent(HttpClient client, IJsonSerializer? jsonSerializer = null, CoreEx.ExecutionContext? executionContext = null) : base(client, jsonSerializer, executionContext) { }

/// <inheritdoc/>
public Task<HttpResult<TransactionCollectionResult>> GetTransactionsAsync(string? accountId, TransactionArgs? args, PagingArgs? paging = null, HttpRequestOptions? requestOptions = null, CancellationToken cancellationToken = default)
=> GetAsync<TransactionCollectionResult>("api/v1/banking/accounts/{accountId}/transactions", requestOptions: requestOptions.IncludePaging(paging), args: HttpArgs.Create(new HttpArg<string?>("accountId", accountId), new HttpArg<TransactionArgs?>("args", args, HttpArgType.FromUriUseProperties)), cancellationToken: cancellationToken);
=> GetAsync<TransactionCollectionResult>("api/v1/banking/accounts/{accountId}/transactions", requestOptions.IncludePaging(paging), [new HttpArg<string?>("accountId", accountId), new HttpArg<TransactionArgs?>("args", args, HttpArgType.FromUriUseProperties)], cancellationToken);
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
<Folder Include="Entities\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="CoreEx" Version="3.27.1" />
<PackageReference Include="CoreEx" Version="3.27.3" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="CoreEx.UnitTesting.NUnit" Version="3.27.1" />
<PackageReference Include="CoreEx.UnitTesting.NUnit" Version="3.27.3" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 3 additions & 1 deletion samples/Cdr.Banking/Cdr.Banking.Test/FixtureSetup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ public void OneTimeSetUp()
if (count == 0)
{
using var test = ApiTester.Create<Startup>();
_cosmosDb = test.Services.GetRequiredService<ICosmos>();
using var scope = test.Services.CreateScope();
_cosmosDb = scope.ServiceProvider.GetRequiredService<ICosmos>();
await _cosmosDb.Database.Client.CreateDatabaseIfNotExistsAsync(_cosmosDb.Database.Id, cancellationToken: ct).ConfigureAwait(false);
Expand Down
2 changes: 1 addition & 1 deletion samples/Demo/Beef.Demo.Api/Beef.Demo.Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CoreEx.AspNetCore" Version="3.27.1" />
<PackageReference Include="CoreEx.AspNetCore" Version="3.27.3" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.9.0" />
<PackageReference Include="Swashbuckle.AspNetCore.Newtonsoft" Version="6.9.0" />
</ItemGroup>
Expand Down
16 changes: 8 additions & 8 deletions samples/Demo/Beef.Demo.Business/Beef.Demo.Business.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="CoreEx" Version="3.27.1" />
<PackageReference Include="CoreEx.AspNetCore" Version="3.27.1" />
<PackageReference Include="CoreEx.Cosmos" Version="3.27.1" />
<PackageReference Include="CoreEx.Database" Version="3.27.1" />
<PackageReference Include="CoreEx.Database.SqlServer" Version="3.27.1" />
<PackageReference Include="CoreEx.EntityFrameworkCore" Version="3.27.1" />
<PackageReference Include="CoreEx.Validation" Version="3.27.1" />
<PackageReference Include="CoreEx.FluentValidation" Version="3.27.1" />
<PackageReference Include="CoreEx" Version="3.27.3" />
<PackageReference Include="CoreEx.AspNetCore" Version="3.27.3" />
<PackageReference Include="CoreEx.Cosmos" Version="3.27.3" />
<PackageReference Include="CoreEx.Database" Version="3.27.3" />
<PackageReference Include="CoreEx.Database.SqlServer" Version="3.27.3" />
<PackageReference Include="CoreEx.EntityFrameworkCore" Version="3.27.3" />
<PackageReference Include="CoreEx.Validation" Version="3.27.3" />
<PackageReference Include="CoreEx.FluentValidation" Version="3.27.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.20" />
</ItemGroup>

Expand Down
1 change: 1 addition & 0 deletions samples/Demo/Beef.Demo.Business/Data/PersonData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ private async Task<Person> MergeOnImplementationAsync(Guid personFromId, Guid pe
private Task MarkOnImplementationAsync()
{
using var scope = _logger.BeginScope(new Dictionary<string, object> { { "MyKey", "MyValue" } });
CoreEx.ExecutionContext.Current.Messages.Add(MessageType.Warning, "Software licence is overdue; please pay immediately or services will be halted.");
_logger.LogWarning("Mark operation implementation currently does not exist.");
return Task.CompletedTask;
}
Expand Down
Loading

0 comments on commit 4f50105

Please sign in to comment.