예제 #1
0
파일: MainForm.cs 프로젝트: S031/MetaStack
 private void ExecuteAction(string actionId)
 {
     using (var cd = new S031.MetaStack.WinForms.Actions.ActionExecuteForm(_grid, actionId))
     {
         if (cd.ShowDialog() == DialogResult.OK)
         {
             OutputWindow.Show();
             OutputWindow.Print(LogLevels.Information, $"Start {actionId}...");
             new System.Threading.Thread(() =>
             {
                 Pipe.Start();
                 try
                 {
                     var dr = ClientGate.Execute(actionId, cd.GetInputParamTable());
                     if (dr.Read())
                     {
                         OutputWindow.Print(LogLevels.Information, $"Result {dr[0]}");
                     }
                 }
                 catch (TCPConnectorException ex)
                 {
                     OutputWindow.Print(LogLevels.Error, $"{ex.Message}\n{ex.RemoteSource}\n{ex.RemoteStackTrace}");
                 }
                 catch (Exception ex)
                 {
                     OutputWindow.Print(LogLevels.Error, $"{ex.Message}\n{ex.StackTrace}");
                 }
                 Pipe.End();
                 OutputWindow.Print(LogLevels.Information, $"Finish {actionId}");
             }).Start();
         }
     }
 }
예제 #2
0
파일: Program.cs 프로젝트: S031/MetaStack
        static void Main(string[] args)
        {
            //var connectionName = Dns.GetHostName() == "SERGEY-WRK" ? "Test" : "BankLocal";
            //var connectionName = "SqliteDb";
            using (FileLog l = new FileLog("TCPConnectorConnectTest", new FileLogSettings()
            {
                DateFolderMask = "yyyy-MM-dd"
            }))
            {
                var config = new JsonReader(ConfigurationManager.AppSettings["TCPConnector"].Replace('\'', '"')).Read();
                ClientGate.Logon(new ConnectorOptions(config));
                DateTime t = DateTime.Now;
                Console.WriteLine("Start performance test for Sys.Select");
                //int i = 0;
                //for (int i = 0; i < 10000; i++)
                Parallel.For(0, 50000, (i, c) =>
                {
                    var dr = ClientGate.GetActionInfo("A_TestForFct")
                             .GetInputParamTable()
                             .AddNew()
                             .SetValue("@ObjectName", "SysCat.SysSchemas")
                             .SetValue("@IDs", "1")
                             .Update();
                    ClientGate.Execute("A_TestForFct", dr);
                    if (i % 1000 == 0)
                    {
                        //dr.Read();
                        Console.WriteLine($"{i}\t{dr[0]}{DateTime.Now.Second}");
                    }
                    //try
                    //{
                    //	var dr = ClientGate.GetData("dbo.V_DealValue",
                    //		"@Date", new DateTime(2018, 10, 4),
                    //		"@BranchID", 2000,
                    //		"@DealType", "");
                    //	if (i % 1000 == 0)
                    //	{
                    //		//dr.Read();
                    //		Console.WriteLine($"{i}\t{dr.Rows[0][0]}{DateTime.Now.Second}");
                    //	}
                    //}
                    //catch (Exception ex)
                    //{
                    //	Console.WriteLine($"{i}\t{ex.Message}");
                    //	c.Break();
                    //}
                });
                Console.WriteLine($"End performance test for {(DateTime.Now - t).TotalMilliseconds} ms Sys.Select");
                ClientGate.Logout();

                //l.Debug("Start performance test for logins");
                //for (i = 0; i < 10000; i++)
                //{
                //	DataPackage dr = new DataPackage("ObjectName.String.64");
                //	dr.SetHeader("ConnectionName", "Test");
                //	dr.AddNew();
                //	dr["ObjectName"] = "SysCat.SysSchema";
                //	dr.Update();

                //	dr = ClientGate.Execute("Sys.GetSchema", dr);
                //	if (i % 1000 == 0)
                //	{
                //		dr.Read();
                //		Console.WriteLine($"{i}\t{DateTime.Now.Second}");
                //		//Console.WriteLine(i);
                //	}
                //}
                //l.Debug($"End performance test for {i} logins");
            }
        }