-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(cherry picked from commit 18312f7)
- Loading branch information
Sabrina Juarez Garcia
committed
Jan 25, 2025
1 parent
2bb0b4b
commit 6377765
Showing
7 changed files
with
118 additions
and
199 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
dotnet/src/extensions/Azure/Abstractions/AzureFunctionsAbstractions.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="StackExchange.Redis" Version="2.8.24" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\..\dotnetcore\GxClasses.Web\GxClasses.Web.csproj" /> | ||
<ProjectReference Include="..\..\..\dotnetcore\GxClasses\GxClasses.csproj" /> | ||
<ProjectReference Include="..\..\..\dotnetcore\Providers\Cache\GxRedis\GxRedis.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
64 changes: 64 additions & 0 deletions
64
dotnet/src/extensions/Azure/Abstractions/HttpHandler/GXAzureRestServices.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
using System; | ||
using GeneXus; | ||
using GeneXus.Application; | ||
using GeneXus.Cache; | ||
using GeneXus.Deploy.AzureFunctions.HttpHandler; | ||
using GeneXus.Utils; | ||
using Microsoft.AspNetCore.Http; | ||
|
||
namespace GxClasses.Web.Middleware | ||
{ | ||
public class GXAzureRestService : GxRestService | ||
{ | ||
static readonly IGXLogger log = GXLoggerFactory.GetLogger<GXAzureRestService>(); | ||
private readonly ICacheService2 _cacheService; | ||
public GXAzureRestService(ICacheService2 redis) : base() | ||
{ | ||
if (GxContext.IsAzureContext) | ||
{ | ||
if (redis != null && redis.GetType() == typeof(Redis)) | ||
{ | ||
_cacheService = redis; | ||
} | ||
else | ||
_cacheService = new InProcessCache(); | ||
} | ||
else | ||
{ | ||
GXLogging.Debug(log, "Error: Not an Azure context."); | ||
throw new Exception("Operation Cancelled. Not an Azure context."); | ||
} | ||
} | ||
public void SetServiceSession(HttpRequest request, HttpResponse response, HttpContext httpContext) | ||
{ | ||
if (GxContext.IsAzureContext) | ||
{ | ||
if ((context != null && context.HttpContext != null) && (Request != null && Response != null)) | ||
{ | ||
GXHttpAzureContext httpAzureContext = new GXHttpAzureContext(Request, Response, _cacheService); | ||
if (httpAzureContext != null && httpAzureContext.Session != null && context != null && context.HttpContext != null) | ||
context.HttpContext.Session = httpAzureContext.Session; | ||
else | ||
GXLogging.Debug(log, $"Error : Azure Serverless session could not be created."); | ||
} | ||
else | ||
{ | ||
if (context != null) | ||
{ | ||
context.HttpContext = httpContext; | ||
GXHttpAzureContext httpAzureContext = new GXHttpAzureContext(request, response, _cacheService); | ||
if (httpAzureContext != null && httpAzureContext.Session != null && context != null && context.HttpContext != null) | ||
context.HttpContext.Session = httpAzureContext.Session; | ||
else | ||
GXLogging.Debug(log, $"Error : Azure Serverless session could not be created."); | ||
} | ||
} | ||
} | ||
else | ||
{ | ||
GXLogging.Debug(log, "Error: Not an Azure context."); | ||
throw new Exception("Operation Cancelled. Not an Azure context."); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 0 additions & 46 deletions
46
dotnet/src/extensions/Azure/Handlers/HttpHandler/GXAzureRestServices.cs
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.