Skip to content

Commit 73660bb

Browse files
Refactor procs and http procs to allow having a common base object and intercept Execute methods.
Remove WebControl as a base clase of GXHttpHandler. Next change will add GXBaseObject as a base class, as in .NETCORE.
1 parent e79cc87 commit 73660bb

File tree

3 files changed

+56
-22
lines changed

3 files changed

+56
-22
lines changed

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

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ namespace GeneXus.Http
4848
#if NETCORE
4949
public abstract class GXHttpHandler : GXBaseObject, IHttpHandler
5050
#else
51-
public abstract class GXHttpHandler : WebControl, IHttpHandler
51+
public abstract class GXHttpHandler : IHttpHandler
5252
#endif
5353
{
5454
static readonly ILog log = log4net.LogManager.GetLogger(typeof(GeneXus.Http.GXHttpHandler));
@@ -77,6 +77,17 @@ public GXHttpHandler()
7777
initpars();
7878
}
7979

80+
#if !NETCORE
81+
protected virtual void ExecutePrivate()
82+
{
83+
84+
}
85+
protected virtual void ExecuteImpl()
86+
{
87+
ExecutePrivate();
88+
}
89+
90+
#endif
8091
public virtual void SetPrefix(string s)
8192
{
8293
}
@@ -2222,15 +2233,8 @@ public virtual bool CompressHtmlResponse()
22222233
return GXUtil.CompressResponse();
22232234
}
22242235

2225-
#if NETCORE
22262236
protected virtual void Render(HtmlTextWriter output)
2227-
#else
2228-
protected override void Render(HtmlTextWriter output)
2229-
#endif
22302237
{
2231-
#if !NETCORE
2232-
localHttpContext = Context;
2233-
#endif
22342238
ControlOutputWriter = output;
22352239
LoadParameters(Parms);
22362240
InitPrivates();
@@ -2833,20 +2837,6 @@ public void ComponentInit()
28332837
initialize();
28342838
}
28352839

2836-
protected override void Render(HtmlTextWriter output)
2837-
{
2838-
ControlOutputWriter = output;
2839-
#if NETCORE
2840-
localHttpContext = localHttpContext;
2841-
#else
2842-
localHttpContext = Context;
2843-
#endif
2844-
LoadParameters(Parms);
2845-
InitPrivates();
2846-
SetPrefix(_prefixId + "_"); // Load Prefix from Name property
2847-
initpars(); // Initialize Iterator Parameters
2848-
webExecuteEx(localHttpContext);
2849-
}
28502840
public virtual void componentdrawstyles()
28512841
{
28522842
}

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ public class GXBaseObject
1919
protected IGxContext _Context;
2020
bool _isMain;
2121
protected bool _isApi;
22+
protected virtual void ExecutePrivate()
23+
{
24+
25+
}
26+
protected virtual void ExecuteImpl()
27+
{
28+
ExecutePrivate();
29+
}
2230

2331
public virtual IGxContext context
2432
{

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

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,42 @@ public GXProcedure()
5959
#endif
6060
}
6161

62+
/*protected static int MainImpl(string[] args, GXProcedure instance)
63+
{
64+
try
65+
{
66+
Config.ParseArgs(ref args);
67+
return instance.ExecuteCmdLine(args);
68+
}
69+
catch (Exception e)
70+
{
71+
GXUtil.SaveToEventLog("Design", e);
72+
Console.WriteLine(e.ToString());
73+
return 1;
74+
}
75+
}
76+
protected virtual int ExecuteCmdLine(string[] args)
77+
{
78+
return GX.GXRuntime.ExitCode;
79+
}*/
80+
protected void SubmitImpl()
81+
{
82+
context.SetSubmitInitialConfig(context);
83+
initialize();
84+
Submit(ExecutePrivateCatch, this);
85+
}
86+
protected virtual void ExecutePrivateCatch(object stateInfo)
87+
{
88+
try
89+
{
90+
((GXProcedure)stateInfo).ExecutePrivate();
91+
}
92+
catch (Exception e)
93+
{
94+
GXUtil.SaveToEventLog("Design", e);
95+
Console.WriteLine(e.ToString());
96+
}
97+
}
6298
public bool DisconnectAtCleanup
6399
{
64100
get{ return disconnectUserAtCleanup;}

0 commit comments

Comments
 (0)