static void Main(string[] args) { BaseDao dao = BaseDaoFactory.CreateBaseDao("dao_test"); //添加 //for (int i = 0; i < 100000; i++) //{ // dao.Insert<test0>(new test0() // { // Address = "上海"+i, // Id = i, // Name = "王"+i // }); // Console.WriteLine(i); //} // //分页查询 IList <string> ilist = new List <string> { "0", "1" }; IDictionary hints = new Dictionary <string, object>(); hints.Add(DALExtStatementConstant.SHARD_IDS, ilist); var query = dao.GetQuery <test0>().Paging(1, 10, "Id", false);//.Equal("Name", "王10000"); var list_ = dao.SelectList <test0>(query, hints).OrderByDescending(x => x.Id).ToList(); Console.ReadLine(); }
static void Main(string[] args) { BaseDao dao = BaseDaoFactory.CreateBaseDao("dao_test"); IAgentGenDao agentGenDao = DALFactory.AgentGenDao; ////DLPT.Entity.DataModel.AgentGen AgentGenaa = new DLPT.Entity.DataModel.AgentGen(); ////AgentGenaa.Id = 1; ////AgentGenaa.Name = "111"; ////dao.Insert<DLPT.Entity.DataModel.AgentGen>(AgentGenaa); IDictionary <String, IList <String> > dict = new Dictionary <String, IList <String> > { { "0", new List <String> { "0", "1" } } }; IDictionary hints = new Dictionary <String, Object>(); IList <String> shards = new List <String> { "0", "1" }; hints.Add(DALExtStatementConstant.TABLE_IDS, shards); var result = dao.ExecScalar("SELECT count(1) from agentGen_{0} where name='77'", null, hints); //"SELECT count(1) from agent_{0} where name='77'" // var result = dao.GetAll<DLPT.Entity.DataModel.AgentGen>(hints, Common.Enums.OperationType.Default); ////String sql = "SELECT count(1) from agent "; ////object obj = dao.ExecScalar(sql); ////long ret = Convert.ToInt64(obj); //("select count(0) from AgentGen "); Console.WriteLine(result); //// IAgentGenDao agentGenDao = DALFactory.AgentGenDao; //// //AgentGen orm = agentGenDao.OrmByHand("select * from table"); //// DLPT.Entity.DataModel.AgentGen AgentGen = new DLPT.Entity.DataModel.AgentGen(); ////// AgentGen.Id = 1; //// AgentGen.Name = "111"; //// int insertResult = agentGenDao.InsertAgentGen(AgentGen); //// Console.WriteLine(insertResult); // Console.ReadKey(); Console.Read(); }
static void Main(string[] args) { BaseDao dao = BaseDaoFactory.CreateBaseDao("dao_test"); ////添加 for (int i = 0; i < 100000; i++) { dao.Insert <test0>(new test0() { Address = "上海" + i, Id = i, Name = "王" + i }); Console.WriteLine(i); //System.Threading.Thread.Sleep(1000 * 1); } /////修改 //dao.Update<test0>(new test0() //{ // Address = "上海测试", // Id = 1, // Name = "王测试" //}); //分页查询 //IList<string> shardDb = new List<string> { "0", "1" }; //IDictionary hints = new Dictionary<string, object>(); //hints.Add(DALExtStatementConstant.SHARD_IDS, shardDb); //var query = dao.GetQuery<test0>().Paging(1, 10, "Id", false); //.Equal("Name", "王10000"); //while (true) //{ // Console.WriteLine("======================================================"); // var list_ = dao.SelectList<test0>(query, hints).OrderByDescending(x => x.Id).ToList(); // System.Threading.Thread.Sleep(1000 * 3); //} Console.ReadLine(); }