Skip to content

Commit d97fa5d

Browse files
Compatibility fix for HttpHandler for each object: Restore WebControl as a base class for GXHttpHandler in .NET Framework.
Add methods ExecuteEx and ExecutePrivate to GXHttpHandler in .NET Framework.
1 parent b1c77f1 commit d97fa5d

File tree

2 files changed

+58
-11
lines changed

2 files changed

+58
-11
lines changed

dotnet/src/dotnetframework/GxClasses/Middleware/GXHttp.cs

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,11 @@ namespace GeneXus.Http
4444
using GeneXus.Notifications;
4545
using Web.Security;
4646
using System.Web.SessionState;
47+
using GeneXus.Mock;
48+
using GeneXus.Data.NTier;
4749
#endif
4850

49-
51+
5052

5153
#if NETCORE
5254
public abstract class GXHttpHandler : GXBaseObject, IHttpHandler
@@ -278,6 +280,61 @@ private bool IsFullAjaxRequest(HttpContext httpContext)
278280
public virtual void initialize() { throw new Exception("The method or operation is not implemented."); }
279281
public virtual void cleanup() { }
280282
virtual public bool UploadEnabled() { return false; }
283+
284+
protected virtual void ExecuteEx()
285+
{
286+
ExecutePrivate();
287+
}
288+
protected virtual void ExecutePrivate()
289+
{
290+
291+
}
292+
protected virtual void ExecutePrivateCatch(object stateInfo)
293+
{
294+
try
295+
{
296+
((GXHttpHandler)stateInfo).ExecutePrivate();
297+
}
298+
catch (Exception e)
299+
{
300+
GXUtil.SaveToEventLog("Design", e);
301+
Console.WriteLine(e.ToString());
302+
}
303+
}
304+
protected void SubmitImpl()
305+
{
306+
GxContext submitContext = new GxContext();
307+
DataStoreUtil.LoadDataStores(submitContext);
308+
IsMain = true;
309+
submitContext.SetSubmitInitialConfig(context);
310+
this.context = submitContext;
311+
initialize();
312+
Submit(ExecutePrivateCatch, this);
313+
}
314+
protected virtual void CloseCursors()
315+
{
316+
317+
}
318+
protected void Submit(Action<object> executeMethod, object state)
319+
{
320+
ThreadUtil.Submit(PropagateCulture(new WaitCallback(executeMethod)), state);
321+
}
322+
public static WaitCallback PropagateCulture(WaitCallback action)
323+
{
324+
var currentCulture = Thread.CurrentThread.CurrentCulture;
325+
GXLogging.Debug(log, "Submit PropagateCulture " + currentCulture);
326+
var currentUiCulture = Thread.CurrentThread.CurrentUICulture;
327+
return (x) =>
328+
{
329+
Thread.CurrentThread.CurrentCulture = currentCulture;
330+
Thread.CurrentThread.CurrentUICulture = currentUiCulture;
331+
action(x);
332+
};
333+
}
334+
protected virtual string[] GetParameters()
335+
{
336+
return null;
337+
}
281338
#endif
282339
public virtual bool SupportAjaxEvent() { return false; }
283340
public virtual String AjaxOnSessionTimeout() { return "Ignore"; }

dotnet/src/dotnetframework/GxClasses/Model/GXWebProcedure.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -222,15 +222,5 @@ protected void GxDrawDynamicBitMap(int printBlock, int controlId, string value,
222222
{
223223
reportMetadata.GxDrawBitMap(printBlock, controlId, line, value, aspectRatio);
224224
}
225-
#if !NETCORE
226-
protected static WaitCallback PropagateCulture(WaitCallback action)
227-
{
228-
return GXProcedure.PropagateCulture(action);
229-
}
230-
protected void Submit(Action<object> executeMethod, object state)
231-
{
232-
ThreadUtil.Submit(PropagateCulture(new WaitCallback(executeMethod)), state);
233-
}
234-
#endif
235225
}
236226
}

0 commit comments

Comments
 (0)