Esempio n. 1
0
        static void Main(string[] args)
        {
            var dt = DateTime.Now;

            DllLoadTest.Test();
            //JSEngineTest.Test();
            //ReflectTest.Test();
            //FrameArrayTest.Test();
            //WebGoTest.Test();
            //SqliteTest.Test();
            //ReflectVersionTest.Test();

            //LinqTest.Test();
            //InvokeTest.Test();
            //DaoLinqSqlTest.test();
            //MobileAPITest.Test();
            //RazorTest.Test();
            //JWTTest.Test();
            //JiangsuTest.Test();
            //HWAPITest.Test();
            //PostgreSqlTest.Test();
            //OracleTest.Test();
            //MiniTools.Test();
            //BaiduTest.test();
            //NPoiTest.Test();
            Console.WriteLine("当前应用路径:" + ComFunc.GetApplicationRoot());
            Console.WriteLine($"cast time:{(DateTime.Now - dt).TotalMilliseconds}ms");
            Console.Read();
        }
Esempio n. 2
0
        public static void Main(string[] args)
        {
            Console.WriteLine(ComFunc.GetApplicationRoot());
            //准备框架环境参数
            GlobalCommon.Logger             = new Log4Net();
            GlobalCommon.ExceptionProcessor = new EWRAExceptionProcessor();
            Console.OutputEncoding          = Encoding.UTF8;

            //设定服务端参数
            //设定监听端口
            if (!String.IsNullOrEmpty(MyConfig.GetConfiguration("Server", "Port")))
            {
                defaultport = MyConfig.GetConfiguration("Server", "Port");
            }
            else if (args != null)
            {
                if (args.Length > 0 && IntStd.IsInt(args[0]))
                {
                    defaultport = args[0];
                }
            }
            Console.WriteLine($"服务器启动监听端口为{defaultport},如果要调整,请在启动应用时,后面接端口参数,或者在appsettings.json中的Server下设定Port参数(配置档优先)");
            var host = new WebHostBuilder()
                       .UseKestrel()
                       .UseContentRoot(Directory.GetCurrentDirectory())
                       .UseUrls("http://*:" + defaultport)
                       .UseIISIntegration()
                       .UseStartup <Startup>()
                       .UseApplicationInsights()
                       .Build();

            host.Run();
        }
Esempio n. 3
0
        public override void Insert(object data, string toTable)
        {
            if (this.conn.State == ConnectionState.Closed)
            {
                this.conn.Open();
            }

            MySqlBulkLoader sbc;

            sbc = new MySqlBulkLoader(this.conn);
            string tmpPath = ComFunc.GetApplicationRoot() + "/" + ComFunc.RandomCode(6) + ".csv"; //Path.GetTempFileName();
            //Console.WriteLine($"csv file path={tmpPath}");
            MySqlBulkLoader bulk = new MySqlBulkLoader(conn)
            {
                FieldTerminator         = ",",
                FieldQuotationCharacter = '"',
                EscapeCharacter         = '"',
                LineTerminator          = "\r\n",
                FileName            = tmpPath,
                NumberOfLinesToSkip = 0,
                TableName           = toTable,
            };

            try
            {
                if (data is DataTableStd)
                {
                    string csv = DataTableToCsv((DataTableStd)data);
                    File.WriteAllText(tmpPath, csv);
                }
                //else if (data is IEnumerable<FrameDLRObject>)
                //{
                //    string csv = ListToCsv((IEnumerable<FrameDLRObject>)data);
                //    File.WriteAllText(tmpPath, csv);
                //}
                else if (data is IEnumerable <object> )
                {
                    string csv = ListToCsv((IEnumerable <object>)data);
                    File.WriteAllText(tmpPath, csv);
                }

                bulk.Load();
            }
            finally
            {
                File.Delete(tmpPath);
            }
            // BulkInsert(data, toTable);
        }