Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,8 @@ string dateTimeToHTMLDate(DateTime dt)

protected virtual HttpContext GetHttpContext()
{
//This method must be virtual so it can be implemented by Azure Functions classes.
//In the case of Azure, the base HttpContext isn't the ControllerBase class HttpContext, but rather the Azure Request HttpContext itself.
return base.HttpContext;
}
protected virtual bool IsSynchronizer { get { return false; } }
Expand Down
27 changes: 1 addition & 26 deletions dotnet/src/extensions/Azure/Handlers/Program.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
using System;
using System.ComponentModel;
using System.IO;
using System.Reflection;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
using GeneXus.Application;
using GeneXus.Cache;
Expand Down Expand Up @@ -39,7 +36,7 @@ static async Task Main()
{

options.JsonSerializerOptions.NumberHandling = System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString;
options.JsonSerializerOptions.Converters.Add(new StringConverter());
options.JsonSerializerOptions.Converters.Add(new GeneXus.Utils.StringConverter());

});
ISessionService sessionService = GXSessionServiceFactory.GetProvider();
Expand All @@ -55,28 +52,6 @@ static async Task Main()
GxContext.IsHttpContext = true;
await host.RunAsync();
}

public class StringConverter : JsonConverter<string>
{
public override string Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
if (reader.TokenType == JsonTokenType.Number)
{
if (reader.TryGetInt32(out int l))
return l.ToString();
else if (reader.TryGetDecimal(out decimal d))
return d.ToString();
else
return reader.GetDouble().ToString();
}
return reader.GetString();
}

public override void Write(Utf8JsonWriter writer, string value, JsonSerializerOptions options)
{
writer.WriteStringValue(value);
}
}
private static string GetRoutePrefix(string ContentRootPath)
{
//Read host.json file to get Route prefix
Expand Down
Loading