Skip to content

Commit

Permalink
v5.15.2 (#257)
Browse files Browse the repository at this point in the history
- *Fixed:* Fixed the event value publish code-generation by enabling an override using `Operation.EventValue` where applicable (i.e. no response).
  • Loading branch information
chullybun authored Sep 25, 2024
1 parent 9520dbd commit ba23d28
Show file tree
Hide file tree
Showing 32 changed files with 72 additions and 49 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

Represents the **NuGet** versions.

## v5.15.2
- *Fixed:* Fixed the event value publish code-generation by enabling an override using `Operation.EventValue` where applicable (i.e. no response).

## v5.15.1
- *Fixed:* Added option `AcceptsBody` to `Parameter.WebApiFrom` to ensure consistent behaviour with `Create` and `Update` operation types in terms of how a body value is handled within the API Controller.
- *Fixed:* Fixed the `value` parameter inference where operation type is `Custom` and the `ValueType` is specified; ensures operation is generated correctly.
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.15.1</Version>
<Version>5.15.2</Version>
<LangVersion>preview</LangVersion>
<Authors>Avanade</Authors>
<Company>Avanade</Company>
Expand Down
1 change: 1 addition & 0 deletions docs/Entity-Operation-Config.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ Provides the _Events_ configuration.
Property | Description
-|-
**`eventPublish`** | The layer to add logic to publish an event for a `Create`, `Update` or `Delete` operation. Valid options are: `None`, `DataSvc`, `Data`.<br/>&dagger; Defaults to the `Entity.EventPublish` configuration property (inherits) where not specified. Used to enable the sending of messages to the likes of EventGrid, Service Broker, SignalR, etc.
`eventValue` | The event value override as C# code (is used as-is).<br/>&dagger; The event value is automatically inferred where the `Operation.Type` is `Create`, `Update` or `Delete`.
`eventSource` | The Event Source.<br/>&dagger; Defaults to `Entity.EventSource`. Note: when used in code-generation the `CodeGeneration.EventSourceRoot` will be prepended where specified. To include the entity id/key include a `{$key}` placeholder (`Create`, `Update` or `Delete` operation only); for example: `person/{$key}`. Otherwise, specify the C# string interpolation expression; for example: `person/{r.Id}`.
`eventSubject` | The event subject template and corresponding event action pair (separated by a colon).<br/>&dagger; The event subject template defaults to `{AppName}.{Entity.Name}`, plus each of the unique key placeholders comma separated; e.g. `Domain.Entity.{id1},{id2}` (depending on whether `Entity.EventSubjectFormat` is `NameAndKey` or `NameOnly`). The event action defaults to `WebApiOperationType` or `Operation.Type` where not specified. Multiple events can be raised by specifying more than one subject/action pair separated by a semicolon. E.g. `Demo.Person.{id}:Create;Demo.Other.{id}:Update`.

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.25.4" />
<PackageReference Include="CoreEx.AspNetCore" Version="3.25.5" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="6.8.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.25.4" />
<PackageReference Include="CoreEx.Cosmos" Version="3.25.4" />
<PackageReference Include="CoreEx.Validation" Version="3.25.4" />
<PackageReference Include="CoreEx.AspNetCore" Version="3.25.5" />
<PackageReference Include="CoreEx.Cosmos" Version="3.25.5" />
<PackageReference Include="CoreEx.Validation" Version="3.25.5" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
<Folder Include="Entities\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="CoreEx" Version="3.25.4" />
<PackageReference Include="CoreEx" Version="3.25.5" />
</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.25.4" />
<PackageReference Include="CoreEx.UnitTesting.NUnit" Version="3.25.5" />
</ItemGroup>

<ItemGroup>
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.25.4" />
<PackageReference Include="CoreEx.AspNetCore" Version="3.25.5" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.8.0" />
<PackageReference Include="Swashbuckle.AspNetCore.Newtonsoft" Version="6.8.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.25.4" />
<PackageReference Include="CoreEx.AspNetCore" Version="3.25.4" />
<PackageReference Include="CoreEx.Cosmos" Version="3.25.4" />
<PackageReference Include="CoreEx.Database" Version="3.25.4" />
<PackageReference Include="CoreEx.Database.SqlServer" Version="3.25.4" />
<PackageReference Include="CoreEx.EntityFrameworkCore" Version="3.25.4" />
<PackageReference Include="CoreEx.Validation" Version="3.25.4" />
<PackageReference Include="CoreEx.FluentValidation" Version="3.25.4" />
<PackageReference Include="CoreEx" Version="3.25.5" />
<PackageReference Include="CoreEx.AspNetCore" Version="3.25.5" />
<PackageReference Include="CoreEx.Cosmos" Version="3.25.5" />
<PackageReference Include="CoreEx.Database" Version="3.25.5" />
<PackageReference Include="CoreEx.Database.SqlServer" Version="3.25.5" />
<PackageReference Include="CoreEx.EntityFrameworkCore" Version="3.25.5" />
<PackageReference Include="CoreEx.Validation" Version="3.25.5" />
<PackageReference Include="CoreEx.FluentValidation" Version="3.25.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.20" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,11 +303,12 @@ public async Task<FileContentResult> GetDocumentationAsync(Guid id)
}

/// <inheritdoc/>
public Task<Result<string?>> SimulateWorkAsync(Guid id)
public Task<Result<string?>> SimulateWorkAsync(Guid id) => DataSvcInvoker.Current.InvokeAsync(this, (_, __) =>
{
return Result.GoAsync(_data.SimulateWorkAsync(id))
.ThenAsync(r => _simulateWorkOnAfterAsync?.Invoke(r, id) ?? Result.SuccessTask);
}
.ThenAsync(r => _simulateWorkOnAfterAsync?.Invoke(r, id) ?? Result.SuccessTask)
.Then(r => _events.PublishValueEvent("WorkIt", new Uri($"/person/", UriKind.Relative), $"Work", "Simulated"));
}, new InvokerArgs { IncludeTransactionScope = true, EventPublisher = _events });
}

#pragma warning restore
Expand Down
2 changes: 1 addition & 1 deletion samples/Demo/Beef.Demo.CodeGen/entity.beef-5.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ entities:
parameters: [
{ name: Id, text: '{{Person}} identifier', type: Guid, isMandatory: true }
]},
{ name: SimulateWork, type: Custom, withResult: true, returnType: string?, webApiRoute: simulate, webApiMethod: HttpGet, webApiStatus: OK, primaryKey: true }
{ name: SimulateWork, type: Custom, withResult: true, returnType: string?, webApiRoute: simulate, webApiMethod: HttpGet, webApiStatus: OK, primaryKey: true, eventSubject: Work:Simulated, eventValue: '"WorkIt"' }
]
}

Expand Down
2 changes: 1 addition & 1 deletion samples/Demo/Beef.Demo.Common/Beef.Demo.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<Folder Include="Agents\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="CoreEx" Version="3.25.4" />
<PackageReference Include="CoreEx" Version="3.25.5" />
<PackageReference Include="Grpc.Tools" Version="2.66.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
2 changes: 1 addition & 1 deletion samples/Demo/Beef.Demo.Test/Beef.Demo.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="CoreEx.UnitTesting" Version="3.25.4" />
<PackageReference Include="CoreEx.UnitTesting" Version="3.25.5" />
<PackageReference Include="NUnit.Analyzers" Version="4.3.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
1 change: 1 addition & 0 deletions samples/Demo/Beef.Demo.Test/PersonTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1306,6 +1306,7 @@ public void I420_Simulate_Perf()
{
AgentTester.Test<PersonAgent, string>()
.ExpectStatusCode(HttpStatusCode.OK)
.ExpectEvent("Work", "Simulated")
.Run(a => a.SimulateWorkAsync(Guid.NewGuid()));
}
}
Expand Down
2 changes: 1 addition & 1 deletion samples/My.Hr/My.Hr.Api/My.Hr.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.25.4" />
<PackageReference Include="CoreEx.AspNetCore" Version="3.25.5" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.8.0" />
<PackageReference Include="Swashbuckle.AspNetCore.Newtonsoft" Version="6.8.0" />
</ItemGroup>
Expand Down
8 changes: 4 additions & 4 deletions samples/My.Hr/My.Hr.Business/My.Hr.Business.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="CoreEx" Version="3.25.4" />
<PackageReference Include="CoreEx.Database.SqlServer" Version="3.25.4" />
<PackageReference Include="CoreEx.EntityFrameworkCore" Version="3.25.4" />
<PackageReference Include="CoreEx.Validation" Version="3.25.4" />
<PackageReference Include="CoreEx" Version="3.25.5" />
<PackageReference Include="CoreEx.Database.SqlServer" Version="3.25.5" />
<PackageReference Include="CoreEx.EntityFrameworkCore" Version="3.25.5" />
<PackageReference Include="CoreEx.Validation" Version="3.25.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.31" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion samples/My.Hr/My.Hr.Common/My.Hr.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="CoreEx" Version="3.25.4" />
<PackageReference Include="CoreEx" Version="3.25.5" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions samples/My.Hr/My.Hr.Test/My.Hr.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="CoreEx" Version="3.25.4" />
<PackageReference Include="CoreEx" Version="3.25.5" />
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand All @@ -42,7 +42,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.25.4" />
<PackageReference Include="CoreEx.UnitTesting.NUnit" Version="3.25.5" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions samples/MyEf.Hr/MyEf.Hr.Api/MyEf.Hr.Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<GenerateDocumentationFile>True</GenerateDocumentationFile>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="CoreEx.AspNetCore" Version="3.25.4" />
<PackageReference Include="CoreEx.Azure" Version="3.25.4" />
<PackageReference Include="CoreEx.AspNetCore" Version="3.25.5" />
<PackageReference Include="CoreEx.Azure" Version="3.25.5" />
<PackageReference Include="OpenTelemetry.Instrumentation.EntityFrameworkCore" Version="1.0.0-beta.11" />
<PackageReference Include="AspNetCore.HealthChecks.Azure.Storage.Blobs" Version="8.0.1" />
<PackageReference Include="Azure.Monitor.OpenTelemetry.AspNetCore" Version="1.2.0" />
Expand Down
8 changes: 4 additions & 4 deletions samples/MyEf.Hr/MyEf.Hr.Business/MyEf.Hr.Business.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="CoreEx" Version="3.25.4" />
<PackageReference Include="CoreEx.Database.SqlServer" Version="3.25.4" />
<PackageReference Include="CoreEx.EntityFrameworkCore" Version="3.25.4" />
<PackageReference Include="CoreEx.Validation" Version="3.25.4" />
<PackageReference Include="CoreEx" Version="3.25.5" />
<PackageReference Include="CoreEx.Database.SqlServer" Version="3.25.5" />
<PackageReference Include="CoreEx.EntityFrameworkCore" Version="3.25.5" />
<PackageReference Include="CoreEx.Validation" Version="3.25.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.8" />
</ItemGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion samples/MyEf.Hr/MyEf.Hr.Common/MyEf.Hr.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
<GenerateDocumentationFile>True</GenerateDocumentationFile>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="CoreEx" Version="3.25.4" />
<PackageReference Include="CoreEx" Version="3.25.5" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
</Content>
</ItemGroup>
<ItemGroup>
<PackageReference Include="CoreEx.Azure" Version="3.25.4" />
<PackageReference Include="CoreEx.Validation" Version="3.25.4" />
<PackageReference Include="CoreEx.Azure" Version="3.25.5" />
<PackageReference Include="CoreEx.Validation" Version="3.25.5" />
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.23.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.ServiceBus" Version="5.22.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.17.4" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="CoreEx.UnitTesting.NUnit" Version="3.25.4" />
<PackageReference Include="CoreEx.UnitTesting.NUnit" Version="3.25.5" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions samples/MyEf.Hr/MyEf.Hr.Test/MyEf.Hr.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="CoreEx" Version="3.25.4" />
<PackageReference Include="CoreEx" Version="3.25.5" />
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand All @@ -42,7 +42,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.25.4" />
<PackageReference Include="CoreEx.UnitTesting.NUnit" Version="3.25.5" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,15 @@
"type": "generated",
"generator": "constant",
"parameters": {
"value": "3.25.4"
"value": "3.25.5"
},
"replaces": "CoreExVersion"
},
"beef_version": {
"type": "generated",
"generator": "constant",
"parameters": {
"value": "5.15.1"
"value": "5.15.2"
},
"replaces": "BeefVersion"
},
Expand Down
12 changes: 12 additions & 0 deletions tools/Beef.CodeGen.Core/Config/Entity/OperationConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,14 @@ public class OperationConfig : ConfigBase<CodeGenConfig, EntityConfig>
Description = "Defaults to the `Entity.EventPublish` configuration property (inherits) where not specified. Used to enable the sending of messages to the likes of EventGrid, Service Broker, SignalR, etc.")]
public string? EventPublish { get; set; }

/// <summary>
/// Gets or sets the event value override code.
/// </summary>
[JsonPropertyName("eventValue")]
[CodeGenProperty("Events", Title = "The event value override as C# code (is used as-is).",
Description = "The event value is automatically inferred where the `Operation.Type` is `Create`, `Update` or `Delete`.")]
public string? EventValue { get; set; }

/// <summary>
/// Gets or sets the URI event source.
/// </summary>
Expand Down Expand Up @@ -1414,6 +1422,10 @@ private void PrepareEvents()
ed.Value = sb.ToString();
}

// Replace (override) where specifically specified.
if (!string.IsNullOrEmpty(EventValue))
ed.Value = EventValue;

Events.Add(ed);
}
}
Expand Down
5 changes: 5 additions & 0 deletions tools/Beef.CodeGen.Core/Schema/entity.beef-5.json
Original file line number Diff line number Diff line change
Expand Up @@ -1566,6 +1566,11 @@
"Data"
]
},
"eventValue": {
"type": "string",
"title": "The event value override as C# code (is used as-is).",
"description": "The event value is automatically inferred where the \u0060Operation.Type\u0060 is \u0060Create\u0060, \u0060Update\u0060 or \u0060Delete\u0060."
},
"eventSource": {
"type": "string",
"title": "The Event Source.",
Expand Down
2 changes: 1 addition & 1 deletion tools/Beef.Database.Core/Beef.Database.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CoreEx.Database" Version="3.25.4" />
<PackageReference Include="CoreEx.Database" Version="3.25.5" />
<PackageReference Include="DbEx" Version="2.5.9" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion tools/Beef.Database.MySql/Beef.Database.MySql.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CoreEx.Database.MySql" Version="3.25.4" />
<PackageReference Include="CoreEx.Database.MySql" Version="3.25.5" />
<PackageReference Include="DbEx.MySql" Version="2.5.9" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion tools/Beef.Database.Postgres/Beef.Database.Postgres.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CoreEx.Database.Postgres" Version="3.25.4" />
<PackageReference Include="CoreEx.Database.Postgres" Version="3.25.5" />
<PackageReference Include="DbEx.Postgres" Version="2.5.9" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CoreEx.Database.SqlServer" Version="3.25.4" />
<PackageReference Include="CoreEx.Database.SqlServer" Version="3.25.5" />
<PackageReference Include="DbEx.SqlServer" Version="2.5.9" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion tools/Beef.Test.NUnit/Beef.Test.NUnit.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CoreEx.UnitTesting.NUnit" Version="3.25.4" />
<PackageReference Include="CoreEx.UnitTesting.NUnit" Version="3.25.5" />
</ItemGroup>

<Import Project="..\..\Common.targets" />
Expand Down

0 comments on commit ba23d28

Please sign in to comment.