31
31
32
32
using System ;
33
33
using System . Collections . Generic ;
34
- using RabbitMQ . Client . Exceptions ;
35
34
using RabbitMQ . Client . Impl ;
36
35
37
36
namespace RabbitMQ . Client . Framing . Impl
@@ -95,11 +94,7 @@ public override void _Private_ChannelFlowOk(bool active)
95
94
96
95
public override void _Private_ChannelOpen ( string outOfBand )
97
96
{
98
- MethodBase __repBase = ModelRpc ( new ChannelOpen ( outOfBand ) ) ;
99
- if ( ! ( __repBase is ChannelOpenOk ) )
100
- {
101
- throw new UnexpectedMethodException ( __repBase ) ;
102
- }
97
+ ModelRpc < ChannelOpenOk > ( new ChannelOpen ( outOfBand ) ) ;
103
98
}
104
99
105
100
public override void _Private_ConfirmSelect ( bool nowait )
@@ -111,21 +106,13 @@ public override void _Private_ConfirmSelect(bool nowait)
111
106
}
112
107
else
113
108
{
114
- MethodBase __repBase = ModelRpc ( method ) ;
115
- if ( ! ( __repBase is ConfirmSelectOk ) )
116
- {
117
- throw new UnexpectedMethodException ( __repBase ) ;
118
- }
109
+ ModelRpc < ConfirmSelectOk > ( method ) ;
119
110
}
120
111
}
121
112
122
113
public override void _Private_ConnectionClose ( ushort replyCode , string replyText , ushort classId , ushort methodId )
123
114
{
124
- MethodBase __repBase = ModelRpc ( new ConnectionClose ( replyCode , replyText , classId , methodId ) ) ;
125
- if ( ! ( __repBase is ConnectionCloseOk ) )
126
- {
127
- throw new UnexpectedMethodException ( __repBase ) ;
128
- }
115
+ ModelRpc < ConnectionCloseOk > ( new ConnectionClose ( replyCode , replyText , classId , methodId ) ) ;
129
116
}
130
117
131
118
public override void _Private_ConnectionCloseOk ( )
@@ -150,11 +137,7 @@ public override void _Private_ConnectionStartOk(IDictionary<string, object> clie
150
137
151
138
public override void _Private_UpdateSecret ( byte [ ] newSecret , string reason )
152
139
{
153
- MethodBase __repBase = ModelRpc ( new ConnectionUpdateSecret ( newSecret , reason ) ) ;
154
- if ( ! ( __repBase is ConnectionUpdateSecretOk ) )
155
- {
156
- throw new UnexpectedMethodException ( __repBase ) ;
157
- }
140
+ ModelRpc < ConnectionUpdateSecretOk > ( new ConnectionUpdateSecret ( newSecret , reason ) ) ;
158
141
}
159
142
160
143
public override void _Private_ExchangeBind ( string destination , string source , string routingKey , bool nowait , IDictionary < string , object > arguments )
@@ -166,11 +149,7 @@ public override void _Private_ExchangeBind(string destination, string source, st
166
149
}
167
150
else
168
151
{
169
- MethodBase __repBase = ModelRpc ( method ) ;
170
- if ( ! ( __repBase is ExchangeBindOk ) )
171
- {
172
- throw new UnexpectedMethodException ( __repBase ) ;
173
- }
152
+ ModelRpc < ExchangeBindOk > ( method ) ;
174
153
}
175
154
}
176
155
@@ -183,11 +162,7 @@ public override void _Private_ExchangeDeclare(string exchange, string type, bool
183
162
}
184
163
else
185
164
{
186
- MethodBase __repBase = ModelRpc ( method ) ;
187
- if ( ! ( __repBase is ExchangeDeclareOk ) )
188
- {
189
- throw new UnexpectedMethodException ( __repBase ) ;
190
- }
165
+ ModelRpc < ExchangeDeclareOk > ( method ) ;
191
166
}
192
167
}
193
168
@@ -200,11 +175,7 @@ public override void _Private_ExchangeDelete(string exchange, bool ifUnused, boo
200
175
}
201
176
else
202
177
{
203
- MethodBase __repBase = ModelRpc ( method ) ;
204
- if ( ! ( __repBase is ExchangeDeleteOk ) )
205
- {
206
- throw new UnexpectedMethodException ( __repBase ) ;
207
- }
178
+ ModelRpc < ExchangeDeleteOk > ( method ) ;
208
179
}
209
180
}
210
181
@@ -217,11 +188,7 @@ public override void _Private_ExchangeUnbind(string destination, string source,
217
188
}
218
189
else
219
190
{
220
- MethodBase __repBase = ModelRpc ( method ) ;
221
- if ( ! ( __repBase is ExchangeUnbindOk ) )
222
- {
223
- throw new UnexpectedMethodException ( __repBase ) ;
224
- }
191
+ ModelRpc < ExchangeUnbindOk > ( method ) ;
225
192
}
226
193
}
227
194
@@ -234,11 +201,7 @@ public override void _Private_QueueBind(string queue, string exchange, string ro
234
201
}
235
202
else
236
203
{
237
- MethodBase __repBase = ModelRpc ( method ) ;
238
- if ( ! ( __repBase is QueueBindOk ) )
239
- {
240
- throw new UnexpectedMethodException ( __repBase ) ;
241
- }
204
+ ModelRpc < QueueBindOk > ( method ) ;
242
205
}
243
206
}
244
207
@@ -264,12 +227,7 @@ public override uint _Private_QueueDelete(string queue, bool ifUnused, bool ifEm
264
227
return 0xFFFFFFFF ;
265
228
}
266
229
267
- MethodBase __repBase = ModelRpc ( method ) ;
268
- if ( ! ( __repBase is QueueDeleteOk __rep ) )
269
- {
270
- throw new UnexpectedMethodException ( __repBase ) ;
271
- }
272
- return __rep . _messageCount ;
230
+ return ModelRpc < QueueDeleteOk > ( method ) . _messageCount ;
273
231
}
274
232
275
233
public override uint _Private_QueuePurge ( string queue , bool nowait )
@@ -281,12 +239,7 @@ public override uint _Private_QueuePurge(string queue, bool nowait)
281
239
return 0xFFFFFFFF ;
282
240
}
283
241
284
- MethodBase __repBase = ModelRpc ( method ) ;
285
- if ( ! ( __repBase is QueuePurgeOk __rep ) )
286
- {
287
- throw new UnexpectedMethodException ( __repBase ) ;
288
- }
289
- return __rep . _messageCount ;
242
+ return ModelRpc < QueuePurgeOk > ( method ) . _messageCount ;
290
243
}
291
244
292
245
public override void BasicAck ( ulong deliveryTag , bool multiple )
@@ -301,11 +254,7 @@ public override void BasicNack(ulong deliveryTag, bool multiple, bool requeue)
301
254
302
255
public override void BasicQos ( uint prefetchSize , ushort prefetchCount , bool global )
303
256
{
304
- MethodBase __repBase = ModelRpc ( new BasicQos ( prefetchSize , prefetchCount , global ) ) ;
305
- if ( ! ( __repBase is BasicQosOk ) )
306
- {
307
- throw new UnexpectedMethodException ( __repBase ) ;
308
- }
257
+ ModelRpc < BasicQosOk > ( new BasicQos ( prefetchSize , prefetchCount , global ) ) ;
309
258
}
310
259
311
260
public override void BasicRecoverAsync ( bool requeue )
@@ -325,38 +274,22 @@ public override IBasicProperties CreateBasicProperties()
325
274
326
275
public override void QueueUnbind ( string queue , string exchange , string routingKey , IDictionary < string , object > arguments )
327
276
{
328
- MethodBase __repBase = ModelRpc ( new QueueUnbind ( default , queue , exchange , routingKey , arguments ) ) ;
329
- if ( ! ( __repBase is QueueUnbindOk ) )
330
- {
331
- throw new UnexpectedMethodException ( __repBase ) ;
332
- }
277
+ ModelRpc < QueueUnbindOk > ( new QueueUnbind ( default , queue , exchange , routingKey , arguments ) ) ;
333
278
}
334
279
335
280
public override void TxCommit ( )
336
281
{
337
- MethodBase __repBase = ModelRpc ( new TxCommit ( ) ) ;
338
- if ( ! ( __repBase is TxCommitOk ) )
339
- {
340
- throw new UnexpectedMethodException ( __repBase ) ;
341
- }
282
+ ModelRpc < TxCommitOk > ( new TxCommit ( ) ) ;
342
283
}
343
284
344
285
public override void TxRollback ( )
345
286
{
346
- MethodBase __repBase = ModelRpc ( new TxRollback ( ) ) ;
347
- if ( ! ( __repBase is TxRollbackOk ) )
348
- {
349
- throw new UnexpectedMethodException ( __repBase ) ;
350
- }
287
+ ModelRpc < TxRollbackOk > ( new TxRollback ( ) ) ;
351
288
}
352
289
353
290
public override void TxSelect ( )
354
291
{
355
- MethodBase __repBase = ModelRpc ( new TxSelect ( ) ) ;
356
- if ( ! ( __repBase is TxSelectOk ) )
357
- {
358
- throw new UnexpectedMethodException ( __repBase ) ;
359
- }
292
+ ModelRpc < TxSelectOk > ( new TxSelect ( ) ) ;
360
293
}
361
294
362
295
public override bool DispatchAsynchronous ( in IncomingCommand cmd )
0 commit comments