File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ namespace Quick.Protocol
88{
99 public class CommandContext
1010 {
11+ public static string GenerateNewId ( ) => Guid . NewGuid ( ) . ToString ( "N" ) . ToLower ( ) ;
1112 public string Id { get ; private set ; }
1213 private CommandException commandException ;
1314 private bool isTimeout = false ;
@@ -16,7 +17,7 @@ public class CommandContext
1617
1718 public CommandContext ( string typeName )
1819 {
19- Id = Guid . NewGuid ( ) . ToString ( "N" ) . ToLower ( ) ;
20+ Id = GenerateNewId ( ) ;
2021 ResponseTask = new Task < CommandResponseTypeNameAndContent > ( ( ) =>
2122 {
2223 if ( isTimeout )
Original file line number Diff line number Diff line change @@ -492,6 +492,19 @@ public Task SendNoticePackage(object package)
492492 return SendNoticePackage ( package . GetType ( ) . FullName , JsonConvert . SerializeObject ( package ) ) ;
493493 }
494494
495+ /// <summary>
496+ /// 发送命令请求包
497+ /// </summary>
498+ /// <param name="request"></param>
499+ /// <returns></returns>
500+ public async Task SendCommandRequest ( object request )
501+ {
502+ var requestType = request . GetType ( ) ;
503+ var typeName = requestType . FullName ;
504+ var requestContent = JsonConvert . SerializeObject ( request ) ;
505+ await SendCommandRequestPackage ( CommandContext . GenerateNewId ( ) , typeName , requestContent ) ;
506+ }
507+
495508 /// <summary>
496509 /// 发送命令请求包
497510 /// </summary>
You can’t perform that action at this time.
0 commit comments