Skip to content

Commit 2f41e14

Browse files
author
Vadim Belov
committed
Update to .NET 10, upgrade deps, and refactor auth handler
Upgraded all projects to .NET 10 and updated NuGet dependencies to latest 10.x versions, including Telegram.Bot and ImageSharp. Renamed UseAuthorizationHandler to AddAuthorizationHandler and changed its DI lifetime from singleton to scoped. Updated usage in ConsoleTest accordingly.
1 parent 6143ec0 commit 2f41e14

5 files changed

Lines changed: 22 additions & 22 deletions

File tree

Sources/TelegramBot.AspNetCoreTest/TelegramBot.AspNetCoreTest.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>net9.0</TargetFramework>
4+
<TargetFramework>net10.0</TargetFramework>
55
<Nullable>enable</Nullable>
66
<ImplicitUsings>enable</ImplicitUsings>
77
</PropertyGroup>

Sources/TelegramBot.ConsoleTest/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public static void Main(string[] args)
3535
.RegisterCommand("/receipt", "показывает чек");
3636
}, "ru")
3737
.AddDbContext<AppDbContext>(x => x.UseSqlite("Data Source=app.db"))
38-
.UseAuthorizationHandler<AuthorizationHandler>();
38+
.AddAuthorizationHandler<AuthorizationHandler>();
3939

4040
var app = builder.Build();
4141
app.Run();

Sources/TelegramBot.ConsoleTest/TelegramBot.ConsoleTest.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net9.0</TargetFramework>
5+
<TargetFramework>net10.0</TargetFramework>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Nullable>enable</Nullable>
88
</PropertyGroup>
@@ -11,12 +11,12 @@
1111
<Content Include="appsettings.json">
1212
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
1313
</Content>
14-
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.10" />
15-
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.10">
14+
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="10.0.5" />
15+
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="10.0.5">
1616
<PrivateAssets>all</PrivateAssets>
1717
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1818
</PackageReference>
19-
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.11" />
19+
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.12" />
2020
<ProjectReference Include="..\TelegramBot\TelegramBot.csproj" />
2121
</ItemGroup>
2222

Sources/TelegramBot/Extensions/ServiceCollectionExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ public static IServiceCollection RegisterCommands(this IServiceCollection servic
5959
/// <typeparam name="THandler">The type of the authorization handler.</typeparam>
6060
/// <param name="services">The service collection.</param>
6161
/// <returns>The modified service collection.</returns>
62-
public static IServiceCollection UseAuthorizationHandler<THandler>(this IServiceCollection services) where THandler : class, IBotAuthorizationHandler
62+
public static IServiceCollection AddAuthorizationHandler<THandler>(this IServiceCollection services) where THandler : class, IBotAuthorizationHandler
6363
{
64-
return services.AddSingleton<IBotAuthorizationHandler, THandler>();
64+
return services.AddScoped<IBotAuthorizationHandler, THandler>();
6565
}
6666

6767
/// <summary>

Sources/TelegramBot/TelegramBot.csproj

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,19 @@
2828
<None Include="..\..\README.md" Pack="true" PackagePath="\" />
2929
<None Include="icon.png" Pack="true" PackagePath="\" />
3030
<None Include="..\..\LICENSE.md" Pack="true" PackagePath="LICENSE.md" />
31-
<PackageReference Include="Telegram.Bot" Version="22.7.2" />
32-
<PackageReference Include="System.Text.Json" Version="9.0.10" />
33-
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.10" />
34-
<PackageReference Include="Microsoft.Extensions.Configuration" Version="9.0.10" />
35-
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="9.0.10" />
36-
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="9.0.10" />
37-
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.10" />
38-
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="9.0.10" />
39-
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.10" />
40-
<PackageReference Include="Microsoft.Extensions.Logging.Configuration" Version="9.0.10" />
41-
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="9.0.10" />
42-
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="9.0.10" />
43-
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
44-
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="9.0.10" />
31+
<PackageReference Include="Telegram.Bot" Version="22.9.5.3" />
32+
<PackageReference Include="System.Text.Json" Version="10.0.5" />
33+
<PackageReference Include="Microsoft.Extensions.Logging" Version="10.0.5" />
34+
<PackageReference Include="Microsoft.Extensions.Configuration" Version="10.0.5" />
35+
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="10.0.5" />
36+
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="10.0.5" />
37+
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.5" />
38+
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="10.0.5" />
39+
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.5" />
40+
<PackageReference Include="Microsoft.Extensions.Logging.Configuration" Version="10.0.5" />
41+
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="10.0.5" />
42+
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="10.0.5" />
43+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="10.0.201" PrivateAssets="All" />
44+
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="10.0.5" />
4545
</ItemGroup>
4646
</Project>

0 commit comments

Comments
 (0)