Enerprise Solution Main Startup method source code

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.