//access http://localhost:3999/api/Test1  get method
        public IHttpActionResult GetTest()
        {
            using (var fact = Wcf <PeopleService>())
            {
                var channel = fact.CreateChannel();

                TB_PeopleQueryObject peopleQueryObject = new TB_PeopleQueryObject();

                int count = 0;
                List <TB_People> peopleList = channel.QueryAll(peopleQueryObject).Cast <List <TB_People> >(out count);

                return(OK("get people list!", peopleList, count));
            }
        }
示例#2
0
        static void Main(string[] args)
        {
            #region Wcf Test
            new Config.ClassRegisters();   //register classes
            new Config.ConfigBootStrap();

            using (var fact = Wcf <PeopleService>())
            {
                var channel = fact.CreateChannel();

                TB_PeopleQueryObject peopleQueryObject = new TB_PeopleQueryObject();

                //peopleQueryObject.Name = "1";
                //peopleQueryObject.Age = 9;


                List <TB_People> peopleList = channel.QueryAll(peopleQueryObject).Cast <List <TB_People> >();

                foreach (var item in peopleList)
                {
                    Console.WriteLine($"{item.Uid} , {item.Name} , {item.Age} , {item.ClassId}");
                }
            }

            //    //TB_People people = channel.QuerySingle(new TB_PeopleQueryObject { QueryCondition = t => t.Name.Equals("lilongji9") }).Cast<TB_People>();

            //    //Console.WriteLine(people.Name);

            //    //people.Name = "jonnyR";

            //    //if (channel.Update(people))
            //    //{
            //    //    Console.WriteLine("success!");
            //    //}

            //    // Console.WriteLine(Internationalization.GetString("MSG_1001"));

            //}

            #endregion



            Console.WriteLine("any key to exit ...");
            Console.ReadKey();
        }