Skip to content

Commit

Permalink
Merge pull request #99 from gpproton/dotner-9-upgrade
Browse files Browse the repository at this point in the history
Dotnet 9 upgrade
  • Loading branch information
gpproton authored Dec 11, 2024
2 parents b71adc7 + dec1ece commit e8e9490
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 65 deletions.
29 changes: 2 additions & 27 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<Title>Axolotl</Title>
<Version>8.0.5</Version>
<Version>9.0.0</Version>
<Authors>radioActive DROID</Authors>
<Description>Personal shared utility library</Description>
<RepositoryType>git</RepositoryType>
Expand All @@ -24,29 +24,4 @@
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<PackageIcon>icon.jpg</PackageIcon>
</PropertyGroup>

<PropertyGroup>
<TargetFrameworks>net7.0;net8.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>12.0</LangVersion>
<NextendedVersion>7.0.47</NextendedVersion>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'net7.0' ">
<ArdalisVersion>7.0.0</ArdalisVersion>
<AspCoreVersion>7.0.14</AspCoreVersion>
<DotnetVersion>7.0.0</DotnetVersion>
<EfcoreVersion>7.0.14</EfcoreVersion>
<BulkExtensions>7.1.6 </BulkExtensions>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'net8.0' ">
<ArdalisVersion>8.0.0</ArdalisVersion>
<AspCoreVersion>8.0.0</AspCoreVersion>
<DotnetVersion>8.0.0</DotnetVersion>
<EfcoreVersion>8.0.0</EfcoreVersion>
<BulkExtensions>8.0.0</BulkExtensions>
</PropertyGroup>

</Project>
</Project>
42 changes: 34 additions & 8 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,40 @@

<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>13.0</LangVersion>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'net8.0' ">
<ArdalisVersion>8.0.0</ArdalisVersion>
<AspCoreVersion>8.0.11</AspCoreVersion>
<DotnetVersion>8.0.0</DotnetVersion>
<EfcoreVersion>8.0.11</EfcoreVersion>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'net9.0' ">
<ArdalisVersion>8.0.0</ArdalisVersion>
<AspCoreVersion>9.0.0</AspCoreVersion>
<DotnetVersion>9.0.0</DotnetVersion>
<EfcoreVersion>9.0.0</EfcoreVersion>
</PropertyGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net8.0' ">
<PackageVersion Include="System.Net.Http.Json" Version="8.0.1" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.11" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net9.0' ">
<PackageVersion Include="System.Net.Http.Json" Version="9.0.0" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="$(DotnetVersion)" />
</ItemGroup>

<!-- Shared packages -->
<ItemGroup>
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="$(DotnetVersion)" />
<PackageVersion Include="Microsoft.Extensions.Primitives" Version="$(DotnetVersion)" />
<PackageVersion Include="System.Net.Http.Json" Version="$(DotnetVersion)" />
<PackageVersion Include="Mapster" Version="7.4.0" />
</ItemGroup>

Expand All @@ -35,11 +62,10 @@

<!-- Test packages -->
<ItemGroup>
<PackageVersion Include="AutoFixture" Version="4.11.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="$(DotnetVersion)" />
<PackageVersion Include="xunit" Version="2.4.2" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.4.5" />
<PackageVersion Include="coverlet.collector" Version="3.2.0" />
<PackageVersion Include="AutoFixture" Version="4.18.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageVersion Include="xunit" Version="2.9.2" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" />
<PackageVersion Include="coverlet.collector" Version="6.0.2" />
</ItemGroup>
</Project>
</Project>
4 changes: 2 additions & 2 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "8.0.200",
"version": "9.0.100",
"rollForward": "latestPatch"
},
"scripts": {
Expand All @@ -14,4 +14,4 @@
"m:init": "dotnet ef migrations add --project samples/aspnet-sample/Axolotl.AspNetSample.csproj --configuration Debug Initial --output-dir Migrations",
"m:update": "dotnet ef database update --project samples/aspnet-sample/Axolotl.AspNetSample.csproj --configuration Debug"
}
}
}
68 changes: 40 additions & 28 deletions samples/aspnet-sample/Program.cs
Original file line number Diff line number Diff line change
@@ -1,41 +1,57 @@
// Copyright 2022 - 2023 Godwin peter .O (me@godwin.dev)
//
// Licensed under the MIT License;
// you may not use this file except in compliance with the License.
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/*
Copyright (c) 2024 <Godwin peter. O>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Author: Godwin peter. O (me@godwin.dev)
Created At: Wed 11 Dec 2024 19:50:56
Modified By: Godwin peter. O (me@godwin.dev)
Modified At: Wed 11 Dec 2024 19:50:56
*/

using DotNetEd.CoreAdmin;
using Axolotl.AspNet;
using Axolotl.AspNetSample.Data;
using Axolotl.EFCore;
using DotNetEd.CoreAdmin;

var builder = WebApplication.CreateBuilder(args);
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen(options => { });

// Data services
builder.Services.RegisterDataContext();
builder.Services.RegisterUnitOfWork<ServiceContext>(pooled: false);
builder.Services.RegisterGenericRepositories(typeof(GenericRepository<,>));
// Axolotl AspNet services
builder.Services.RegisterGenericServices();
builder.Services.RegisterFeatures(typeof(Program).Assembly);

builder.Services.AddHostedService<MigrationService>();
builder.Services.AddCoreAdmin(new CoreAdminOptions {
Title = "Sample Admin",
ShowPageSizes = true,
PageSizes = new Dictionary<int, string> {
{ 25, "25"},
{ 100, "100"},
{ 0, "All"}
},
IgnoreEntityTypes = new List<Type>()
});
builder.Services.AddCoreAdmin(
new CoreAdminOptions {
Title = "Sample Admin",
ShowPageSizes = true,
PageSizes = new Dictionary<int, string>
{
{ 25, "25" },
{ 100, "100" },
{ 0, "All" },
},
IgnoreEntityTypes = new List<Type>(),
}
);

var app = builder.Build();
if (app.Environment.IsDevelopment()) {
Expand All @@ -48,13 +64,9 @@
app.UseRouting();
app.UseStaticFiles();
app.UseAuthorization();

// Axolotl app DI
app.RegisterFeatureEndpoints();

app.MapGet("/", () => "x").WithName("Default").WithTags("Root");
app.UseCoreAdminCustomUrl("admin");
app.UseCoreAdminCustomAuth(_ => Task.FromResult(true));


app.Run();

0 comments on commit e8e9490

Please sign in to comment.