Exemplo n.º 1
0
 public override Task <PersonListResponse> GetPersonList(GetPersonRequest request, ServerCallContext context)
 {
     return(Task.Factory.StartNew <PersonListResponse>(() =>
     {
         TestEntity.BLL.Person bll = new TestEntity.BLL.Person();
         var result = bll.GetPersonList(new TestEntity.Params.GetPersonParam());
         var response = new PersonListResponse();
         return response;
     }));
 }
Exemplo n.º 2
0
        /*
         * 1,AutoMapping的使用实例
         * 2,Task异步
         */
        public override Task <PersonListResponse> GetPersonList(GetPersonRequest request, ServerCallContext context)
        {
            return(Task.Factory.StartNew <PersonListResponse>(() =>
            {
                var response = new PersonListResponse();

                TestEntity.BLL.Person bll = new TestEntity.BLL.Person();
                var result = bll.GetPersonList(Mapper.Map <GetPersonRequest, TestEntity.Params.GetPersonParam>(request));
                response.Pager = Mapper.Map <TestEntity.Models.Pager <TestEntity.Models.Person>, PagerResponse>(result);
                response.List.AddRange(Mapper.Map <List <TestEntity.Models.Person>, List <Person> >(result.Items));

                return response;
            }));
        }