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
6 changes: 6 additions & 0 deletions dotnet/src/dotnetframework/GxClasses/Core/GXApplication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,10 @@ public override void Abort()
}
}
#endif
internal class GxApplication
{
internal static GxContext MainContext { get; set; }
}
[Serializable]
public class GxContext : IGxContext
{
Expand Down Expand Up @@ -448,6 +452,8 @@ public GxContext()
setContext(this);
httpContextVars = new GxHttpContextVars();
GXLogging.Debug(log, "GxContext.Ctr Default handle:", () => _handle.ToString());
if (GxApplication.MainContext == null && !(IsHttpContext || GxContext.IsRestService))
GxApplication.MainContext = this;
}
public GxContext(int handle, string location)
{
Expand Down
5 changes: 2 additions & 3 deletions dotnet/src/dotnetframework/GxClasses/Model/gxproc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ public abstract class GXProcedure: GXBaseObject
private DateTime beginExecute;
private ProcedureInfo pInfo;
#endif

public GXProcedure()
{
#if !NETCORE
Expand All @@ -56,10 +55,10 @@ public GXProcedure()
beginExecute = DateTime.Now;
pInfo = ProceduresInfo.addProcedureInfo(name);
pInfo.incCount();

}
#endif
}

public bool DisconnectAtCleanup
{
get{ return disconnectUserAtCleanup;}
Expand Down Expand Up @@ -91,7 +90,7 @@ protected void exitApplication()
}
private void exitApplication(bool flushBatchCursor)
{
if (!(GxContext.IsHttpContext || GxContext.IsRestService) && IsMain && !(context as GxContext).IsSubmited)
if (!(GxContext.IsHttpContext || GxContext.IsRestService) && IsMain && GxApplication.MainContext==context)
ThreadUtil.WaitForEnd();

if (flushBatchCursor)
Expand Down