Skip to content

Commit c815cd0

Browse files
author
Meir Kriheli
committed
rename variable to "potentialServiceContract" until the point we really sure it is a service contract. better readability.
1 parent 688a754 commit c815cd0

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/protobuf-net.Grpc/Configuration/ServerBinder.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,18 @@ public int Bind(object state, Type serviceType, BinderConfiguration? binderConfi
3939
object?[]? argsBuffer = null;
4040
Type[] typesBuffer = Array.Empty<Type>();
4141
if (binderConfiguration == null) binderConfiguration = BinderConfiguration.Default;
42-
var serviceContracts = typeof(IGrpcService).IsAssignableFrom(serviceType)
42+
var potentialServiceContracts = typeof(IGrpcService).IsAssignableFrom(serviceType)
4343
? new HashSet<Type> {serviceType}
4444
: ContractOperation.ExpandInterfaces(serviceType);
4545

4646
bool serviceImplSimplifiedExceptions = serviceType.IsDefined(typeof(SimpleRpcExceptionsAttribute));
47-
foreach (var serviceContract in serviceContracts)
47+
foreach (var potentialServiceContract in potentialServiceContracts)
4848
{
49-
if (!binderConfiguration.Binder.IsServiceContract(serviceContract, out var serviceName)) continue;
49+
if (!binderConfiguration.Binder.IsServiceContract(potentialServiceContract, out var serviceName)) continue;
5050

51+
// now that we know it is a service contract type for sure
52+
var serviceContract = potentialServiceContract;
53+
5154
var typesToBeIncludedInMethodsBinding =
5255
ContractOperation.ExpandWithInterfacesMarkedAsServiceInheritable(serviceContract);
5356

0 commit comments

Comments
 (0)