/// <summary>
 /// 构造
 /// </summary>
 public DapperRepository()
 {
     //改string映射
     //SqlMapper.AddTypeMap(typeof(string), System.Data.DbType.AnsiString);
     Conn       = DataBasePool.getInstance().getConnection();//DbConnectionFactory.CreateDbConnection();
     unitOfWork = new UnitOfWork <T>(Conn);
 }
Ejemplo n.º 2
0
        void Application_Start(object sender, EventArgs e)
        {
            // to expose native dlls of SZKingdom
            String path = String.Concat(Environment.GetEnvironmentVariable("PATH"), ";", AppDomain.CurrentDomain.RelativeSearchPath);

            Environment.SetEnvironmentVariable("PATH", path, EnvironmentVariableTarget.Process);

            SignalRStartup.InitializeIoc();
            AutoMapperWebConfiguration.Configure();

            DataBasePool.InitializeDatabase();

            // Code that runs on application startup
            AreaRegistration.RegisterAllAreas();
            GlobalConfig.CustomizeConfig(GlobalConfiguration.Configuration);
            GlobalConfiguration.Configure(WebApiConfig.Register);
            FiltersConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            FiltersConfig.RegisterWebApiFilters(GlobalConfiguration.Configuration.Filters);

            RouteConfig.RegisterRoutes(RouteTable.Routes);

            BundleConfig.RegisterBundles(BundleTable.Bundles);

            //HibernatingRhinos.Profiler.Appender.EntityFramework.EntityFrameworkProfiler.Initialize();
            Database.SetInitializer(new OptionsPlayDatabaseInitializer());
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            Log.Init(1, 50240000, "yyyyMMdd", @"./logs/", LogType.Debug);

            DataBaseOperator.SetDbIniFilePath(".");
            Log.WriteDebugLog("ControlCenter::Startup", "Begin connect db");

            string connStr = DataBasePool.AddDataBaseConnectionString("debit", "!%(**$*@^77f1fjj", 5, 5);

            Log.WriteDebugLog("ControlCenter::Startup", connStr);
            DataBaseOperator.Init("debit");

            string serverInfo = "172.22.0.12:6379";
            string password   = "******";

            RedisPools.RedisPools.Init(serverInfo, Proxy.None, 200, password);

            ControlCenter cc = new ControlCenter();

            cc.Start();

            while (true)
            {
                Thread.Sleep(100000);
            }
        }
Ejemplo n.º 4
0
        //===========================通用方法==============================
        public static DataTable Query(string cmd)
        {
            mySqlC = DataBasePool.getInstance().getConnection();

            MySqlDataReader sdr = new MySqlCommand(cmd, mySqlC).ExecuteReader();
            DataTable       dt  = new DataTable();

            dt.Load(sdr);
            mySqlC.Close();
            return(dt);
        }
Ejemplo n.º 5
0
        static void Main(string[] args)
        {
            //AGUSTINUS WAHYU TETRA NO      !=agustinus wahyu tetra novranta
            //:             !=

            Console.WriteLine(Convert.ToString(Levenshtein("CHINTIA D W LASUT", "chintia dervini wulandari lasut".ToUpper())));

            Log.Init(1, 50240000, "yyyyMMdd", @"./logs/", LogType.Debug);

            DataBaseOperator.SetDbIniFilePath(".");
            Log.WriteDebugLog("ControlCenter::Startup", "Begin connect db");

            string connStr = DataBasePool.AddDataBaseConnectionString("debittest", "!%(**$*@^77f1fjj", 5, 5);

            Log.WriteDebugLog("ControlCenter::Startup", connStr);
            DataBaseOperator.Init("debittest");

            ControlCenter cc = new ControlCenter();

            cc.Start();

            while (true)
            {
                Thread.Sleep(100000);
            }

            return;

            string serverInfo = "127.0.0.1:6379";
            string password   = "******";

            RedisPools.RedisPools.Init(serverInfo, Proxy.None, 200, password);

            LoanBank bank = new LoanBank();

            DebitUserRecord record = new DebitUserRecord();

            record.debitId        = 111;
            record.bankAccount    = "1680001297876";
            record.bankCode       = "008";
            record.amountTransfer = 10000;
            record.purpose        = "test";
            record.userId         = 27;
            record.userName       = "******";

            string errMsg = String.Empty;

            bank.Transfer(record, out errMsg);


            //bank.CheckTransferStatus("10013");
            //$paramSignature = $email . $timestamp . $bankCode . $bankAccount . $accountName . $custRefNumber . $amountTransfer . $purpose . $disburseId . $secretKey;
        }
Ejemplo n.º 6
0
        public long Count(string sql, object paramPairs = null)
        {
            var conn = DataBasePool.getInstance().getConnection();

            if (conn.State != ConnectionState.Open)
            {
                conn.Open();
            }
            var result = conn.Query <long>(sql, paramPairs).SingleOrDefault();

            DataBasePool.getInstance().releaseConnection(conn);
            return(result);
        }
Ejemplo n.º 7
0
        public int Execute(string sql, object paramPairs = null)
        {
            var conn = DataBasePool.getInstance().getConnection();

            if (conn.State != ConnectionState.Open)
            {
                conn.Open();
            }
            var result = conn.Execute(sql, paramPairs);

            DataBasePool.getInstance().releaseConnection(conn);
            return(result);
        }
Ejemplo n.º 8
0
        public bool IsExist(string sql)
        {
            try {
                var conn = DataBasePool.getInstance().getConnection();
                if (conn.State != ConnectionState.Open)
                {
                    conn.Open();
                }
                var result = conn.ExecuteScalar(sql) != null;
                DataBasePool.getInstance().releaseConnection(conn);

                return(result);
            }
            catch (Exception e)
            {
                log.Error(e.Message);
                throw;
            }
        }
Ejemplo n.º 9
0
 public T QueryBuild <T>(Func <IDbConnection, T> callback) where T : class
 {
     try
     {
         var conn = DataBasePool.getInstance().getConnection();
         if (conn.State != ConnectionState.Open)
         {
             conn.Open();
         }
         var result = callback(conn);
         DataBasePool.getInstance().releaseConnection(conn);
         return(result);
     }
     catch (Exception e)
     {
         log.Error(e.Message);
         throw;
     }
 }
Ejemplo n.º 10
0
        public Startup(IConfiguration config)
        {
            Configuration = config;
            Log.Init(1, 50240000, "yyyyMMdd", @"./logs/", LogType.Debug);

            string DBName    = config["AppSettings:DBName"];
            string publicKey = config["AppSettings:publicKey"];

            DataBaseOperator.SetDbIniFilePath(".");
            Log.WriteDebugLog("Startup::Startup", "Begin connect db");
            string conStr = DataBasePool.AddDataBaseConnectionString(DBName, publicKey, 5, 5);

            DataBaseOperator.Init(DBName);
            Log.WriteDebugLog("WebApiApplication::Application_Start", "New 数据库连接串:{0}", conStr);

            ThreadPool.SetMinThreads(100, 100);
            ThreadPool.SetMaxThreads(2048, 2048);

            string serverInfo = config["AppSettings:RedisExchangeHosts"];
            string password   = config["AppSettings:RedisExchangePwd"];

            RedisPools.RedisPools.Init(serverInfo, Proxy.None, 200, password);
        }