private MethodBuilder CreateExecuteMethod( OperationDescriptor operationDescriptor, string runtimeTypeName) { MethodBuilder executeMethod = MethodBuilder .New() .SetOnlyDeclaration() .SetReturnType( TypeNames.Task.WithGeneric( TypeNames.IOperationResult.WithGeneric(runtimeTypeName))) .SetName(TypeNames.Execute); foreach (var arg in operationDescriptor.Arguments) { executeMethod .AddParameter() .SetName(NameUtils.GetParameterName(arg.Name)) .SetType(arg.Type.ToTypeReference()); } executeMethod .AddParameter(_cancellationToken) .SetType(TypeNames.CancellationToken) .SetDefault(); return(executeMethod); }
private MethodBuilder CreateWatchMethod( OperationDescriptor descriptor, string runtimeTypeName) { MethodBuilder watchMethod = MethodBuilder .New() .SetOnlyDeclaration() .SetReturnType( TypeNames.IOperationObservable .WithGeneric(TypeNames.IOperationResult.WithGeneric(runtimeTypeName))) .SetName(TypeNames.Watch); foreach (var arg in descriptor.Arguments) { watchMethod .AddParameter() .SetName(NameUtils.GetParameterName(arg.Name)) .SetType(arg.Type.ToTypeReference()); } watchMethod.AddParameter() .SetName(_strategy) .SetType(TypeNames.ExecutionStrategy.MakeNullable()) .SetDefault("null"); return(watchMethod); }