public async Task <SMessageHistoryListenerDetail> QueryByName(Guid historyId, string name)
        {
            var storeInfo = await StoreInfoHelper.GetHashStoreInfo(_storeInfoResolveService, _hashGroupRepository, _messageHistoryListenerDetailHashGroupName, historyId.ToString());

            if (!storeInfo.TableNames.TryGetValue(HashEntityNames.SMessageHistoryListenerDetail, out string tableNameListenerDetail))
            {
                var fragment = new TextFragment()
                {
                    Code = TextCodes.NotFoundKeyInHashNodeKeyInfo,
                    DefaultFormatting = "哈希组{0}中的哈希节点关键信息中找不到键值{1}",
                    ReplaceParameters = new List <object>()
                    {
                        _messageHistoryListenerDetailHashGroupName, HashEntityNames.SMessageHistoryListenerDetail
                    }
                };

                throw new UtilityException((int)Errors.NotFoundKeyInHashNodeKeyInfo, fragment);
            }
            if (!storeInfo.TableNames.TryGetValue(HashEntityNames.SMessageHistory, out string tableNameHistory))
            {
                var fragment = new TextFragment()
                {
                    Code = TextCodes.NotFoundKeyInHashNodeKeyInfo,
                    DefaultFormatting = "哈希组{0}中的哈希节点关键信息中找不到键值{1}",
                    ReplaceParameters = new List <object>()
                    {
                        _messageHistoryListenerDetailHashGroupName, HashEntityNames.SMessageHistory
                    }
                };

                throw new UtilityException((int)Errors.NotFoundKeyInHashNodeKeyInfo, fragment);
            }

            SMessageHistoryListenerDetail smessageHistoryListenerDetail = null;

            await DBTransactionHelper.SqlTransactionWorkAsync(DBTypes.SqlServer, false, false, _messageQueueConnectionFactory.CreateReadForSMessageHistoryListenerDetail(storeInfo.DBConnectionNames), async (conn, transaction) =>
            {
                SqlTransaction sqlTran = null;
                if (transaction != null)
                {
                    sqlTran = (SqlTransaction)transaction;
                }
                await using (SqlCommand command = new SqlCommand()
                {
                    Connection = (SqlConnection)conn,
                    CommandType = CommandType.Text,
                    CommandText = string.Format(@"SELECT {0},{1} 
                                                  FROM {2} as d join  {3} as h on (d.smessagehistoryid = h.id )
                                                  WHERE [ListenerName]=@listenername and SMessageHistoryID = @historyId",
                                                StoreHelper.GetSMessageHistoryListenerDetailSelectFields("d"), StoreHelper.GetSMessageHistorySelectFields("h"),
                                                tableNameListenerDetail, tableNameHistory),
                    Transaction = sqlTran,
                })
                {
                    var parameter = new SqlParameter("@listenername", SqlDbType.NVarChar, 100)
                    {
                        Value = name
                    };
                    command.Parameters.Add(parameter);

                    parameter = new SqlParameter("@historyId", SqlDbType.UniqueIdentifier)
                    {
                        Value = historyId
                    };
                    command.Parameters.Add(parameter);


                    await command.PrepareAsync();
                    SqlDataReader reader = null;

                    using (reader = await command.ExecuteReaderAsync())
                    {
                        if (await reader.ReadAsync())
                        {
                            smessageHistoryListenerDetail = new SMessageHistoryListenerDetail();
                            StoreHelper.SetSMessageHistoryListenerDetailSelectFields(smessageHistoryListenerDetail, reader, "d");
                            smessageHistoryListenerDetail.SMessageHistory = new SMessageHistory();
                            StoreHelper.SetSMessageHistorySelectFields(smessageHistoryListenerDetail.SMessageHistory, reader, "h");
                        }
                        await reader.CloseAsync();
                    }
                }
            });


            return(smessageHistoryListenerDetail);
        }