The. NET system takes the main method as the starting entry point for the application, and the startup program source code for Enterprise solution is as follows:
[STAThread]Static voidMain () {stringMain_instance_key ="Enterprisemain"; Singleprograminstance maininstance =NewSingleprograminstance (Main_instance_key);if(!maininstance.issingleinstance) {maininstance.raiseotherprocess ();return; } CustomExceptionHandler eh =NewCustomExceptionHandler (); AppDomain.CurrentDomain.UnhandledException + =NewUnhandledexceptioneventhandler (customexceptionhandler.currentdomain_unhandledexception); Application.ThreadException + =NewThreadExceptionEventHandler (EH. OnThreadException); Application.setcompatibletextrenderingdefault (false); Application.enablevisualstyles (); Application.doevents (); Basecommon.setprocesspriority (Processpriorityclass.abovenormal); Serializationhelper.optimization = Serializationoptimization.fast; Serializationhelper.preserveobjectids =false; Readconfigfile (); ApplicationInstance.Appplication.Run (Environment.getcommandlineargs ()); }
1 single-piece mode, the computer can only start a process instance. If the system is already started, only the process is woken up again, showing the main form.
2 exception handling. The WinForms program implements custom industry exception handling, which throws exception blocking processing in. NET code, containing the full stack that throws the exception.
3 Set the priority level of the process to speed up execution.
4 Set the ORM serialization mode. Each entity has an ID identifier, which is set not to generate an ID, which can be run faster than the block ORM.
If this is the debug phase, you can leave this option handy for debugging diagnostic issues.
5 Read the configuration file.
6 Start the program main interface. Applied to a parameterized way to start. Here the application can start the component cache, validate the license file, test the database connection, and connect to the application server (. NET Remoting) program.
For example, to pass the startup parameters to the process Flex mis 2, the meaning of the 4 parameters is to log into the Flex book, using the login username and password followed by MIS, login interface using 2 (Simplified Chinese).
Enerprise Solution Main Startup method source code