Wisej.NET Migration
  • Introduction
  • WinForms to Wisej.NET
    • WinForms Migration First Steps
    • Advanced Topics
      • Statics vs. Session Variables
      • Reporting
      • Office Automation
      • Modal Dialogs
      • Registry Access
      • File Access
    • Optimizations After Migration
      • Alert Boxes
      • Watermarks
      • Tool Buttons
      • Enhanced TabControl
      • Enhanced DataGridView
      • AllowHtml
      • Label Wrapper
      • VirtualScroll
      • Theming
      • Responsive Properties
  • VB6 to Wisej.NET
    • VB6 Migration First Steps
  • Gupta to Wisej.NET
    • SAL Migration First Steps
  • Visual WebGUI to Wisej.NET
    • VWG Migration First Steps
    • VWG Advanced Migration
Powered by GitBook
On this page

Was this helpful?

  1. WinForms to Wisej.NET
  2. Advanced Topics

Statics vs. Session Variables

PreviousAdvanced TopicsNextReporting

Last updated 2 years ago

Was this helpful?

After migrating your applications to Wisej.NET you need to inspect all your static variables. By default statics are shared among all applications in the same AppDomain (Application Pool in IIS).

Some of the statics that are global lookups (like a list of countries or languages or currencies) and independent from a user, can stay static.

Most statics must now become variables. Variables stored in the object are visible only to a single user/session. The session object is a dynamic object and can be used as if the variables were its members.

Sample usage:

// Session is a dynamic object
Application.Session.MyVar1 = 1;
Application.Session.MyVar2 = “Test”;
// Statics moved to session
MyClass.Static1 = “Hello”;
// Becomes
Statics.MyClass.Static1 = “Hello”;
// It’s an easy search/replace.
Statics {
	MyClass { get {
		return Application.Session.MyClass; }}}

session
Application.Session