Skip to content

Commit fc64d40

Browse files
sjuarezgxsjuarez
andauthored
Fixes to Azure Serverless deployment (#1135)
Co-authored-by: sjuarez <sabrina.juarez@globant.com>
1 parent 29fbf18 commit fc64d40

File tree

2 files changed

+3
-26
lines changed

2 files changed

+3
-26
lines changed

dotnet/src/dotnetcore/GxClasses.Web/Middleware/GXRestServices.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,8 @@ string dateTimeToHTMLDate(DateTime dt)
542542

543543
protected virtual HttpContext GetHttpContext()
544544
{
545+
//This method must be virtual so it can be implemented by Azure Functions classes.
546+
//In the case of Azure, the base HttpContext isn't the ControllerBase class HttpContext, but rather the Azure Request HttpContext itself.
545547
return base.HttpContext;
546548
}
547549
protected virtual bool IsSynchronizer { get { return false; } }

dotnet/src/extensions/Azure/Handlers/Program.cs

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
using System;
2-
using System.ComponentModel;
31
using System.IO;
42
using System.Reflection;
53
using System.Text.Json;
6-
using System.Text.Json.Serialization;
74
using System.Threading.Tasks;
85
using GeneXus.Application;
96
using GeneXus.Cache;
@@ -39,7 +36,7 @@ static async Task Main()
3936
{
4037

4138
options.JsonSerializerOptions.NumberHandling = System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString;
42-
options.JsonSerializerOptions.Converters.Add(new StringConverter());
39+
options.JsonSerializerOptions.Converters.Add(new GeneXus.Utils.StringConverter());
4340

4441
});
4542
ISessionService sessionService = GXSessionServiceFactory.GetProvider();
@@ -55,28 +52,6 @@ static async Task Main()
5552
GxContext.IsHttpContext = true;
5653
await host.RunAsync();
5754
}
58-
59-
public class StringConverter : JsonConverter<string>
60-
{
61-
public override string Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
62-
{
63-
if (reader.TokenType == JsonTokenType.Number)
64-
{
65-
if (reader.TryGetInt32(out int l))
66-
return l.ToString();
67-
else if (reader.TryGetDecimal(out decimal d))
68-
return d.ToString();
69-
else
70-
return reader.GetDouble().ToString();
71-
}
72-
return reader.GetString();
73-
}
74-
75-
public override void Write(Utf8JsonWriter writer, string value, JsonSerializerOptions options)
76-
{
77-
writer.WriteStringValue(value);
78-
}
79-
}
8055
private static string GetRoutePrefix(string ContentRootPath)
8156
{
8257
//Read host.json file to get Route prefix

0 commit comments

Comments
 (0)