Skip to content

Commit

Permalink
Merge pull request #107 from aspnetboilerplate/upgrade-to-abp-9-3
Browse files Browse the repository at this point in the history
Upgraded ABP to version 9.3 and NuGet packages to latest version
  • Loading branch information
ismcagdas authored Jul 24, 2024
2 parents 7305d24 + dc015a5 commit 61785e5
Show file tree
Hide file tree
Showing 8 changed files with 115 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Abp.EntityFrameworkCore" Version="9.2.2" />
<PackageReference Include="Abp.AutoMapper" Version="9.2.2" />
<PackageReference Include="Abp.EntityFrameworkCore" Version="9.3.0" />
<PackageReference Include="Abp.AutoMapper" Version="9.3.0" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Abp" Version="9.2.2" />
<PackageReference Include="Abp" Version="9.3.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Abp.EntityFrameworkCore" Version="9.2.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Analyzers" Version="8.0.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.4">
<PackageReference Include="Abp.EntityFrameworkCore" Version="9.3.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Analyzers" Version="8.0.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.7">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="1.1.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.4">
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.7">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="8.0.4" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="8.0.7" />
<PackageReference Include="System.Net.Primitives" Version="4.3.1" />
<PackageReference Include="System.Net.NameResolution" Version="4.3.0" />
<PackageReference Include="Castle.LoggingFacility.MsLogging" Version="3.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="8.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="8.0.2" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="8.0.3" />
<PackageReference Include="Castle.Core" Version="5.1.1" />
<PackageReference Include="Abp.AspNetCore" Version="9.2.2" />
<PackageReference Include="Abp.Castle.Log4Net" Version="9.2.2" />
<PackageReference Include="Abp.AspNetCore" Version="9.3.0" />
<PackageReference Include="Abp.Castle.Log4Net" Version="9.3.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
using System;
using System.Globalization;
using System.Linq;
using Abp;
using Abp.AspNetCore.Mvc.Controllers;
using Abp.AspNetCore.Mvc.Extensions;
using Abp.Auditing;
using Abp.Extensions;
using Abp.Timing;
using Abp.Web.Models;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Localization;
using Microsoft.AspNetCore.Mvc;
using IUrlHelper = Abp.Web.Http.IUrlHelper;

namespace AbpCompanyName.AbpProjectName.Web.Controllers
{
public class LocalizationController : AbpController
{
private readonly IUrlHelper _urlHelper;

public LocalizationController(IUrlHelper urlHelper)
{
_urlHelper = urlHelper;
}

[DisableAuditing]
public virtual ActionResult ChangeCulture(string cultureName, string returnUrl = "")
{
if (!IsValidCultureCode(cultureName))
{
throw new AbpException("Unknown language: " + cultureName + ". It must be a valid culture!");
}

var cookieValue = CookieRequestCultureProvider.MakeCookieValue(
new RequestCulture(cultureName, cultureName)
);

Response.Cookies.Append(
CookieRequestCultureProvider.DefaultCookieName,
cookieValue,
new CookieOptions
{
Expires = Clock.Now.AddYears(2),
HttpOnly = true
}
);

if (Request.IsAjaxRequest())
{
return Json(new AjaxResponse());
}

if (string.IsNullOrWhiteSpace(returnUrl))
{
return LocalRedirect("/");
}

var escapedReturnUrl = Uri.EscapeDataString(returnUrl);
var localPath = _urlHelper.LocalPathAndQuery(escapedReturnUrl, Request.Host.Host, Request.Host.Port);
if (!string.IsNullOrWhiteSpace(localPath))
{
var unescapedLocalPath = Uri.UnescapeDataString(localPath);
if (Url.IsLocalUrl(unescapedLocalPath))
{
return LocalRedirect(unescapedLocalPath);
}
}

return LocalRedirect("/");
}

private static bool IsValidCultureCode(string cultureCode)
{
if (cultureCode.IsNullOrWhiteSpace())
{
return false;
}

try
{
return CultureInfo.GetCultures(CultureTypes.AllCultures)
.Any(e => e.Name.ToLowerInvariant() == cultureCode.ToLowerInvariant());
}
catch (CultureNotFoundException)
{
return false;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{
if (language.Name != Model.CurrentLanguage.Name)
{
<li><a href="@Url.Action("ChangeCulture", "AbpLocalization")?cultureName=@(language.Name)&returnUrl=@(Model.CurrentUrl)"><div class="@language.Icon"></div> @language.DisplayName</a></li>
<li><a href="@Url.Action("ChangeCulture", "Localization")?cultureName=@(language.Name)&returnUrl=@(Model.CurrentUrl)"><div class="@language.Icon"></div> @language.DisplayName</a></li>
}
}
</ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@

<ItemGroup>
<PackageReference Include="Castle.Core" Version="5.1.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="xunit" Version="2.7.1" />
<PackageReference Include="xunit.extensibility.execution" Version="2.7.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.8">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="xunit" Version="2.9.0" />
<PackageReference Include="xunit.extensibility.execution" Version="2.9.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Shouldly" Version="4.2.1" />
<PackageReference Include="Abp.TestBase" Version="9.2.2" />
<PackageReference Include="Abp.TestBase" Version="9.3.0" />
<PackageReference Include="NSubstitute" Version="5.1.0" />
<PackageReference Include="Castle.Windsor.MsDependencyInjection" Version="4.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="8.0.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="8.0.7" />
<PackageReference Include="Microsoft.DotNet.InternalAbstractions" Version="1.0.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@

<ItemGroup>
<PackageReference Include="Castle.Core" Version="5.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.4" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.7" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="Shouldly" Version="4.2.1" />
<PackageReference Include="xunit" Version="2.7.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.8">
<PackageReference Include="xunit" Version="2.9.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />
<PackageReference Include="Abp.AspNetCore.TestBase" Version="9.2.2" />
<PackageReference Include="Abp.AspNetCore.TestBase" Version="9.3.0" />
<PackageReference Include="AngleSharp" Version="1.1.2" />
</ItemGroup>

Expand Down

0 comments on commit 61785e5

Please sign in to comment.