예제 #1
0
 public async Task <List <NameByIdDto> > FindNameListByIdList(NameByIdParams request)
 {
     return(await Task.Run(() =>
     {
         Channel channel = ClientFindCreateChannel.CreateChannel(_Mname, "FindNameListByIdListService").Result;
         var client = this._ProxyClient(channel);
         var serverRes = client.FindNameListByIdList(request);
         channel.ShutdownAsync();   //关闭长连接
         return serverRes;
     }));
 }
예제 #2
0
        private Task <List <NameByIdDto> > AutoFindNameListByIdList(Task <List <NameByIdDto> > idQueryList, Func <List <int> > func, string qFields, Func <NameByIdParams, Task <List <NameByIdDto> > > funcClient)
        {
            if (idQueryList == null)
            {
                Type           inType         = typeof(NameByIdParams);
                NameByIdParams nameByIdParams = new NameByIdParams();
                nameByIdParams.IdList = func();
                string[] fieldArray = qFields.Split(",");
                for (int i = 0; i < fieldArray.Length; i++)
                {
                    inType.GetProperty($"MappingDbField{i + 1}").SetValue(nameByIdParams, fieldArray[i]);
                }
                idQueryList = funcClient(nameByIdParams);
            }

            return(idQueryList);
        }
예제 #3
0
        /// <summary>
        /// 根据传入的list id集合 查询对应的名称集合
        /// </summary>
        /// <param name="request"></param>
        /// <param name="context"></param>
        /// <returns></returns>
        public virtual Task <List <NameByIdDto> > FindNameListByIdList(NameByIdParams request, ServerCallContext context)
        {
            return(Task.Run(() =>
            {
                Dictionary <string, string> dictionaryMapping = new Dictionary <string, string>();


                var mList = baseService().FindAll <NameByIdDto>(
                    LambdaSelectBuilder.BuildSelect <M, NameByIdDto>(new Dictionary <string, string> {
                    { "NAME1", request.MappingDbField1 },
                    { "NAME2", request.MappingDbField2 },
                    { "NAME3", request.MappingDbField3 },
                    { "NAME4", request.MappingDbField4 },
                    { "NAME5", request.MappingDbField5 },
                    { "NAME6", request.MappingDbField6 },
                    { "NAME7", request.MappingDbField7 }
                })
                    , p => request.IdList.Contains(p.ID)
                    );
                return mList.Result;
            }));
        }