Skip to content

Commit

Permalink
v5.12.7
Browse files Browse the repository at this point in the history
- *Fixed*: Fixes the model code-generation to auto implement the `ITenantId` and `ILogicallyDeleted` where corresponding properties are defined.
- *Fixed*: Fixed the manager code-generation to output the `IdentifierGenerator` code where inheriting the `Id` property.
  • Loading branch information
chullybun committed Jun 25, 2024
1 parent 43e314a commit f953a79
Show file tree
Hide file tree
Showing 29 changed files with 80 additions and 61 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

Represents the **NuGet** versions.

## v5.12.7
- *Fixed*: Fixes the model code-generation to auto implement the `ITenantId` and `ILogicallyDeleted` where corresponding properties are defined.
- *Fixed*: Fixed the manager code-generation to output the `IdentifierGenerator` code where inheriting the `Id` property.

## v5.12.6
- *Fixed*: The EF Model generation has had the `ITenantId.TenantId` filtering removed as out-of-the-box EF caches first and uses resulting in an unexpected side-effect. The `CoreEx.EntityFramework` as of `v3.20.0` automatically includes tenant filtering to achieve the desired behavior.
- *Fixed:* Upgraded `CoreEx` (`v3.20.0`) to include all related fixes and improvements.
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.12.6</Version>
<Version>5.12.7</Version>
<LangVersion>preview</LangVersion>
<Authors>Avanade</Authors>
<Company>Avanade</Company>
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.20.0" />
<PackageReference Include="CoreEx.AspNetCore" Version="3.21.0" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="6.6.2" />
</ItemGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
<Folder Include="DataSvc\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="CoreEx.AspNetCore" Version="3.20.0" />
<PackageReference Include="CoreEx.Cosmos" Version="3.20.0" />
<PackageReference Include="CoreEx.Validation" Version="3.20.0" />
<PackageReference Include="CoreEx.AspNetCore" Version="3.21.0" />
<PackageReference Include="CoreEx.Cosmos" Version="3.21.0" />
<PackageReference Include="CoreEx.Validation" Version="3.21.0" />
</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.20.0" />
<PackageReference Include="CoreEx" Version="3.21.0" />
</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.10.0" />
<PackageReference Include="CoreEx.UnitTesting.NUnit" Version="3.20.0" />
<PackageReference Include="CoreEx.UnitTesting.NUnit" Version="3.21.0" />
</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.20.0" />
<PackageReference Include="CoreEx.AspNetCore" Version="3.21.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.2" />
<PackageReference Include="Swashbuckle.AspNetCore.Newtonsoft" Version="6.6.2" />
</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.20.0" />
<PackageReference Include="CoreEx.AspNetCore" Version="3.20.0" />
<PackageReference Include="CoreEx.Cosmos" Version="3.20.0" />
<PackageReference Include="CoreEx.Database" Version="3.20.0" />
<PackageReference Include="CoreEx.Database.SqlServer" Version="3.20.0" />
<PackageReference Include="CoreEx.EntityFrameworkCore" Version="3.20.0" />
<PackageReference Include="CoreEx.Validation" Version="3.20.0" />
<PackageReference Include="CoreEx.FluentValidation" Version="3.20.0" />
<PackageReference Include="CoreEx" Version="3.21.0" />
<PackageReference Include="CoreEx.AspNetCore" Version="3.21.0" />
<PackageReference Include="CoreEx.Cosmos" Version="3.21.0" />
<PackageReference Include="CoreEx.Database" Version="3.21.0" />
<PackageReference Include="CoreEx.Database.SqlServer" Version="3.21.0" />
<PackageReference Include="CoreEx.EntityFrameworkCore" Version="3.21.0" />
<PackageReference Include="CoreEx.Validation" Version="3.21.0" />
<PackageReference Include="CoreEx.FluentValidation" Version="3.21.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.20" />
</ItemGroup>

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.20.0" />
<PackageReference Include="CoreEx" Version="3.21.0" />
<PackageReference Include="Grpc.Tools" Version="2.64.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.20.0" />
<PackageReference Include="CoreEx.UnitTesting" Version="3.21.0" />
<PackageReference Include="NUnit.Analyzers" Version="4.2.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
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.20.0" />
<PackageReference Include="CoreEx.AspNetCore" Version="3.21.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.2" />
<PackageReference Include="Swashbuckle.AspNetCore.Newtonsoft" Version="6.6.2" />
</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.20.0" />
<PackageReference Include="CoreEx.Database.SqlServer" Version="3.20.0" />
<PackageReference Include="CoreEx.EntityFrameworkCore" Version="3.20.0" />
<PackageReference Include="CoreEx.Validation" Version="3.20.0" />
<PackageReference Include="CoreEx" Version="3.21.0" />
<PackageReference Include="CoreEx.Database.SqlServer" Version="3.21.0" />
<PackageReference Include="CoreEx.EntityFrameworkCore" Version="3.21.0" />
<PackageReference Include="CoreEx.Validation" Version="3.21.0" />
<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.20.0" />
<PackageReference Include="CoreEx" Version="3.21.0" />
</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.20.0" />
<PackageReference Include="CoreEx" Version="3.21.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.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.10.0" />
<PackageReference Include="CoreEx.UnitTesting.NUnit" Version="3.20.0" />
<PackageReference Include="CoreEx.UnitTesting.NUnit" Version="3.21.0" />
</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.20.0" />
<PackageReference Include="CoreEx.Azure" Version="3.20.0" />
<PackageReference Include="CoreEx.AspNetCore" Version="3.21.0" />
<PackageReference Include="CoreEx.Azure" Version="3.21.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.EntityFrameworkCore" Version="1.0.0-beta.9" />
<PackageReference Include="AspNetCore.HealthChecks.Azure.Storage.Blobs" Version="8.0.1" />
<PackageReference Include="Azure.Monitor.OpenTelemetry.AspNetCore" Version="1.1.1" />
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.20.0" />
<PackageReference Include="CoreEx.Database.SqlServer" Version="3.20.0" />
<PackageReference Include="CoreEx.EntityFrameworkCore" Version="3.20.0" />
<PackageReference Include="CoreEx.Validation" Version="3.20.0" />
<PackageReference Include="CoreEx" Version="3.21.0" />
<PackageReference Include="CoreEx.Database.SqlServer" Version="3.21.0" />
<PackageReference Include="CoreEx.EntityFrameworkCore" Version="3.21.0" />
<PackageReference Include="CoreEx.Validation" Version="3.21.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.6" />
</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 @@ -4,6 +4,6 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="CoreEx" Version="3.20.0" />
<PackageReference Include="CoreEx" Version="3.21.0" />
</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.20.0" />
<PackageReference Include="CoreEx.Validation" Version="3.20.0" />
<PackageReference Include="CoreEx.Azure" Version="3.21.0" />
<PackageReference Include="CoreEx.Validation" Version="3.21.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.22.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.ServiceBus" Version="5.18.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.17.2" />
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.20.0" />
<PackageReference Include="CoreEx.UnitTesting.NUnit" Version="3.21.0" />
</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.20.0" />
<PackageReference Include="CoreEx" Version="3.21.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.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.10.0" />
<PackageReference Include="CoreEx.UnitTesting.NUnit" Version="3.20.0" />
<PackageReference Include="CoreEx.UnitTesting.NUnit" Version="3.21.0" />
</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.20.0"
"value": "3.21.0"
},
"replaces": "CoreExVersion"
},
"beef_version": {
"type": "generated",
"generator": "constant",
"parameters": {
"value": "5.12.6"
"value": "5.12.7"
},
"replaces": "BeefVersion"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
Host.CreateDefaultBuilder()
.ConfigureWebHostDefaults(b => b.UseStartup<Startup>())
.ConfigureAppConfiguration(c => c.AddEnvironmentVariables("AppName_").AddCommandLine(args))
.ConfigureServices(s =>
{
var builder = WebApplication.CreateBuilder(args);
builder.Configuration.AddEnvironmentVariables("Bookings_");

var startup = new Startup();
startup.ConfigureServices(builder.Services);

#if (implement_entityframework)
s.AddOpenTelemetry().UseAzureMonitor().WithTracing(b => b.AddEntityFrameworkCoreInstrumentation().AddSource("CoreEx.*", "Company.AppName.*"));
builder.Services.AddOpenTelemetry().UseAzureMonitor().WithTracing(b => b.AddEntityFrameworkCoreInstrumentation().AddSource("CoreEx.*", "Company.AppName.*"));
#else
s.AddOpenTelemetry().UseAzureMonitor().WithTracing(b => b.AddSource("CoreEx.*", "Company.AppName.*"));
builder.Services.AddOpenTelemetry().UseAzureMonitor().WithTracing(b => b.AddSource("CoreEx.*", "Company.AppName.*"));
#endif
})
.Build()
.Run();

var app = builder.Build();
startup.Configure(app);

app.Run();
2 changes: 1 addition & 1 deletion tools/Beef.CodeGen.Core/Beef.CodeGen.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

<ItemGroup>
<PackageReference Include="OnRamp" Version="2.2.0" />
<PackageReference Include="DbEx" Version="2.5.2" />
<PackageReference Include="DbEx" Version="2.5.3" />
</ItemGroup>

<Import Project="..\..\Common.targets" />
Expand Down
14 changes: 13 additions & 1 deletion tools/Beef.CodeGen.Core/Config/Entity/EntityConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1715,7 +1715,7 @@ private void InferImplements()

if (PrimaryKeyProperties.Count == 1)
{
var id = Properties!.FirstOrDefault(x => x.Name == "Id" && CompareNullOrValue(x.Inherited, false));
var id = PrimaryKeyProperties!.FirstOrDefault(x => x.Name == "Id" && CompareNullOrValue(x.Inherited, false));
if (id != null)
{
var iid = id.Type switch
Expand All @@ -1736,6 +1736,12 @@ private void InferImplements()
}
}
}
else if (PrimaryKeyPropertiesIncludeInherited.Count == 1)
{
var id = PrimaryKeyPropertiesIncludeInherited!.FirstOrDefault(x => x.Name == "Id");
if (id != null)
HasIdentifier = true;
}
}

if (!HasIdentifier && Properties!.Any(x => CompareValue(x.PrimaryKey, true) && CompareNullOrValue(x.Inherited, false)))
Expand Down Expand Up @@ -1772,6 +1778,12 @@ private void InferImplements()
if (Properties!.Any(x => x.IsChangeLog && CompareNullOrValue(x.Inherited, false) && CompareNullOrValue(x.InternalOnly, false)))
commonImplements.Insert(c++, "IChangeLog");
}

if (Properties!.Any(x => x.Name == "TenantId" && x.Type == "string" && CompareNullOrValue(x.Inherited, false)))
modelImplements.Insert(m++, "ITenantId");

if (Properties!.Any(x => x.Name == "IsDeleted" && x.Type == "bool" && CompareNullOrValue(x.Nullable, true) && CompareNullOrValue(x.Inherited, false)))
modelImplements.Insert(m++, "ILogicallyDeleted");
}

EntityImplements = implements.Count == 0 ? null : string.Join(", ", implements.GroupBy(x => x).Select(y => y.First()).ToArray());
Expand Down
4 changes: 2 additions & 2 deletions tools/Beef.Database.Core/Beef.Database.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CoreEx.Database" Version="3.20.0" />
<PackageReference Include="DbEx" Version="2.5.2" />
<PackageReference Include="CoreEx.Database" Version="3.21.0" />
<PackageReference Include="DbEx" Version="2.5.3" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions tools/Beef.Database.MySql/Beef.Database.MySql.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CoreEx.Database.MySql" Version="3.20.0" />
<PackageReference Include="DbEx.MySql" Version="2.5.2" />
<PackageReference Include="CoreEx.Database.MySql" Version="3.21.0" />
<PackageReference Include="DbEx.MySql" Version="2.5.3" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions tools/Beef.Database.Postgres/Beef.Database.Postgres.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CoreEx.Database.Postgres" Version="3.20.0" />
<PackageReference Include="DbEx.Postgres" Version="2.5.2" />
<PackageReference Include="CoreEx.Database.Postgres" Version="3.21.0" />
<PackageReference Include="DbEx.Postgres" Version="2.5.3" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions tools/Beef.Database.SqlServer/Beef.Database.SqlServer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CoreEx.Database.SqlServer" Version="3.20.0" />
<PackageReference Include="DbEx.SqlServer" Version="2.5.2" />
<PackageReference Include="CoreEx.Database.SqlServer" Version="3.21.0" />
<PackageReference Include="DbEx.SqlServer" Version="2.5.3" />
</ItemGroup>

<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.20.0" />
<PackageReference Include="CoreEx.UnitTesting.NUnit" Version="3.21.0" />
</ItemGroup>

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

0 comments on commit f953a79

Please sign in to comment.