Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updateted to .NET 8.0, NuGet Packages updated #62

Merged
merged 1 commit into from
Mar 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 28 additions & 28 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
<Project>
<ItemGroup>
<PackageVersion Include="Meziantou.Analyzer" Version="2.0.82" />
<PackageVersion Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.7.30" />
<PackageVersion Include="Meziantou.Analyzer" Version="2.0.145" />
<PackageVersion Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.9.28" />
<PackageVersion Include="Microsoft.CodeAnalysis.BannedApiAnalyzers" Version="3.3.4" />
<PackageVersion Include="AsyncFixer" Version="1.6.0" />
<PackageVersion Include="Asyncify" Version="0.9.7" />
<PackageVersion Include="SonarAnalyzer.CSharp" Version="9.8.0.76515" />
<PackageVersion Include="SonarAnalyzer.CSharp" Version="9.20.0.85982" />
<PackageVersion Include="SecurityCodeScan.VS2019" Version="5.6.7" />
<PackageVersion Include="Roslynator.Analyzers" Version="4.5.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Analyzers" Version="7.0.8" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.8" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.8" />
<PackageVersion Include="Roslynator.Analyzers" Version="4.11.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Analyzers" Version="8.0.2" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.2" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.2" />
<PackageVersion Include="DNTBreadCrumb.Core" Version="2.0.2" />
<PackageVersion Include="DNTCaptcha.Core" Version="4.8.1" />
<PackageVersion Include="DNTCommon.Web.Core" Version="3.5.3" />
<PackageVersion Include="System.Drawing.Common" Version="7.0.0" />
<PackageVersion Include="DNTPersianUtils.Core" Version="5.7.1" />
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="7.0.8" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Relational" Version="7.0.8" />
<PackageVersion Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="7.0.8" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.InMemory" Version="7.0.8" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.8" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Abstractions" Version="7.0.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration" Version="7.0.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.4" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.8" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="7.0.8" />
<PackageVersion Include="DNTCaptcha.Core" Version="5.0.0" />
<PackageVersion Include="DNTCommon.Web.Core" Version="3.9.0" />
<PackageVersion Include="System.Drawing.Common" Version="8.0.2" />
<PackageVersion Include="DNTPersianUtils.Core" Version="5.9.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="8.0.2" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Relational" Version="8.0.2" />
<PackageVersion Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.2" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.InMemory" Version="8.0.2" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.2" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.2" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="8.0.2" />
<PackageVersion Include="Microsoft.Extensions.Identity.Stores" Version="7.0.8" />
<PackageVersion Include="System.ComponentModel.Annotations" Version="5.0.0" />
<PackageVersion Include="Microsoft.Extensions.Options" Version="7.0.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
<PackageVersion Include="MSTest.TestAdapter" Version="3.1.1" />
<PackageVersion Include="MSTest.TestFramework" Version="3.1.1" />
<PackageVersion Include="Microsoft.Extensions.Caching.SqlServer" Version="7.0.8" />
<PackageVersion Include="Microsoft.Extensions.Options" Version="8.0.2" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageVersion Include="MSTest.TestAdapter" Version="3.2.2" />
<PackageVersion Include="MSTest.TestFramework" Version="3.2.2" />
<PackageVersion Include="Microsoft.Extensions.Caching.SqlServer" Version="8.0.2" />
<PackageVersion Include="cloudscribe.Web.Pagination" Version="6.0.0" />
<PackageVersion Include="LigerShark.WebOptimizer.Core" Version="3.0.386" />
<PackageVersion Include="LigerShark.WebOptimizer.Core" Version="3.0.405" />
<PackageVersion Include="Microsoft.Web.LibraryManager.Build" Version="2.1.175" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "7.0.306",
"version": "8.0",
"rollForward": "latestMajor",
"allowPrerelease": false
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
Expand Down
9 changes: 5 additions & 4 deletions src/ASPNETCoreIdentitySample.Common/WebToolkit/ServerInfo.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
namespace ASPNETCoreIdentitySample.Common.WebToolkit;
namespace ASPNETCoreIdentitySample.Common.WebToolkit;

public static class ServerInfo
{
private static readonly string[] BinSplitArray = new[] { "bin" };
public static string GetAppDataFolderPath()
{
var appDataFolderPath = Path.Combine(GetWwwRootPath(), "App_Data");
Expand All @@ -16,7 +17,7 @@ public static string GetAppDataFolderPath()
public static string GetWwwRootPath()
{
return Path.Combine(
AppContext.BaseDirectory.Split(new[] { "bin" }, StringSplitOptions.RemoveEmptyEntries)[0],
"wwwroot");
AppContext.BaseDirectory.Split(BinSplitArray, StringSplitOptions.RemoveEmptyEntries)[0],
"wwwroot");
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\ASPNETCoreIdentitySample.DataLayer\ASPNETCoreIdentitySample.DataLayer.csproj" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\ASPNETCoreIdentitySample.DataLayer\ASPNETCoreIdentitySample.DataLayer.csproj" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\ASPNETCoreIdentitySample.DataLayer\ASPNETCoreIdentitySample.DataLayer.csproj" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\ASPNETCoreIdentitySample.Entities\ASPNETCoreIdentitySample.Entities.csproj" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\ASPNETCoreIdentitySample.Common\ASPNETCoreIdentitySample.Common.csproj" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\ASPNETCoreIdentitySample.Common\ASPNETCoreIdentitySample.Common.csproj" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<None Include="..\ASPNETCoreIdentitySample\appsettings.json" CopyToOutputDirectory="PreserveNewest" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\ASPNETCoreIdentitySample.Common\ASPNETCoreIdentitySample.Common.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ private static string FixGmailDots(string email)
var emailParts = email.Split('@');
var name = emailParts[0].Replace(".", string.Empty, StringComparison.OrdinalIgnoreCase);

var plusIndex = name.IndexOf("+", StringComparison.OrdinalIgnoreCase);
var plusIndex = name.IndexOf('+', StringComparison.OrdinalIgnoreCase);
if (plusIndex != -1)
{
name = name.Substring(0, plusIndex);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,21 @@ namespace ASPNETCoreIdentitySample.Services.Identity;
/// </summary>
public class CustomSecurityStampValidator : SecurityStampValidator<User>
{
private readonly ISystemClock _clock;
private readonly IOptions<SecurityStampValidatorOptions> _options;
private readonly IApplicationSignInManager _signInManager;
private readonly ISiteStatService _siteStatService;

public CustomSecurityStampValidator(
IOptions<SecurityStampValidatorOptions> options,
IApplicationSignInManager signInManager,
ISystemClock clock,
ISiteStatService siteStatService,
ILoggerFactory logger)
: base(options, (SignInManager<User>)signInManager, clock, logger)
: base(options, (SignInManager<User>)signInManager, logger)
{
_options = options ?? throw new ArgumentNullException(nameof(options));
_signInManager = signInManager ?? throw new ArgumentNullException(nameof(signInManager));
_siteStatService = siteStatService ?? throw new ArgumentNullException(nameof(siteStatService));
_clock = clock;

}

public TimeSpan UpdateLastModifiedDate { get; set; } = TimeSpan.FromMinutes(2);
Expand All @@ -48,9 +46,9 @@ private async Task UpdateUserLastVisitDateTimeAsync(CookieValidatePrincipalConte
}

var currentUtc = DateTimeOffset.UtcNow;
if (context.Options != null && _clock != null)
if (context.Options != null)
{
currentUtc = _clock.UtcNow;
currentUtc = TimeProvider.GetUtcNow();
}

var issuedUtc = context.Properties.IssuedUtc;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,16 @@ public class DbLogger : ILogger
SetStateJson(state, appLogItem);
_loggerProvider.AddLogItem(new LoggerItem { Props = props, AppLogItem = appLogItem });
}

private static readonly JsonSerializerOptions JsonSerializerOptions = new JsonSerializerOptions
{
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
WriteIndented = true,
};
private static void SetStateJson<TState>(TState state, AppLogItem appLogItem)
{
try
{
appLogItem.StateJson = JsonSerializer.Serialize(
state,
new JsonSerializerOptions
{
DefaultIgnoreCondition =
JsonIgnoreCondition.WhenWritingNull,
WriteIndented = true,
});
appLogItem.StateJson = JsonSerializer.Serialize(state, JsonSerializerOptions);
}
catch
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\ASPNETCoreIdentitySample.Entities\ASPNETCoreIdentitySample.Entities.csproj" />
Expand All @@ -12,4 +12,34 @@
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" />
<PackageReference Include="System.ComponentModel.Annotations" />
</ItemGroup>
<ItemGroup>
<PackageReference Update="Meziantou.Analyzer">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Update="Microsoft.EntityFrameworkCore.Analyzers">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Update="Microsoft.EntityFrameworkCore.Design">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Update="Microsoft.EntityFrameworkCore.Tools">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Update="Microsoft.VisualStudio.Threading.Analyzers">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Update="Roslynator.Analyzers">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Update="SonarAnalyzer.CSharp">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<OutputType>Exe</OutputType>
</PropertyGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/ASPNETCoreIdentitySample/Views/Shared/_Layout.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
<div class="text-center footer-text">
<span class="copyright-text">
<span class="fas fa-heart" style="color:DarkRed" aria-hidden="true"></span>
<a href="http://www.dntips.ir/" target="_blank">DNT, 2017</a>
<a href="http://www.dntips.ir/" target="_blank">DNT, 2024</a>
</span>
</div>
</div>
Expand Down
Loading