Ejemplo n.º 1
0
        public void TestMapTo()
        {
            var config = new ConnectionConfig
            {
                ProviderName     = "SQLServer",
                ConnectionString = ""
            };

            DbConnectionManager.RegisterAdapter(new SqlServerLtsAdapter());
            DbConnectionManager.RegisterDatabaseFor <DapperFor>();

            var adapter = DbConnectionManager.Get(config.ProviderName);

            var sql = new SQL(@"select 
                replace(max(gmfmc),' ','') as gmfmc,
                max(ywrq) as wrq,
                max(kplx) as autoKp,
                replace(max(sprsjh),' ','') as sprsjh,
                replace(max(sprmc),' ','') as  skr,   
                replace(max(spryx),' ','') as spryx,
                replace(max(addtel),' ','') as gmfdzdh,
                replace(max(gmfsh),' ','') as gmfsbh,
                replace(max(kfhzh),' ','') as gmfkhhjzh,  
                max(bz) as bz,
                sum(spje) as jshj,
                max(dsddh) as ddbh,
                max(fplx) as invoiceType
                from dzfp
                where ywdjid=@requestid");

            string requestid = "201909060000050";

            //var results = provider.Query<string>(connection, sql.ToString(adapter.Settings));

            var param = new Dictionary <string, object>();

            sql.Parameters.ForEach(token =>
            {
                param[adapter.Settings.ParamterName(token)] = requestid;
            });

            //var applyDto = provider.QueryFirst<ApplyDto>(connection, sql.ToString(adapter.Settings), param);
        }