本文整理汇总了C#中Operation.SetFriendlyNameAndDescription方法的典型用法代码示例。如果您正苦于以下问题:C# Operation.SetFriendlyNameAndDescription方法的具体用法?C# Operation.SetFriendlyNameAndDescription怎么用?C# Operation.SetFriendlyNameAndDescription使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Operation
的用法示例。
在下文中一共展示了Operation.SetFriendlyNameAndDescription方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: applyUnregisterCallbackInfo
/// <summary>
/// Applies appropriate metadata for operation responsible for unregistering callbacks
/// </summary>
/// <param name="operation">Callback unregistration operation</param>
/// <param name="apiDescription">Implementation metadata</param>
private static void applyUnregisterCallbackInfo(Operation operation, ApiDescription apiDescription)
{
var operationUnregisterCallbackInfoResult = apiDescription.ActionDescriptor.GetCustomAttributes<UnregisterCallbackAttribute>();
var operationUnregisterCallbackInfo = operationUnregisterCallbackInfoResult == null ? null : operationUnregisterCallbackInfoResult.FirstOrDefault();
if (operationUnregisterCallbackInfo != null)
{
operation.SetFriendlyNameAndDescription("Unregister Callback", "Unregisters the callback from being invoked when the event is triggered");
applyTriggerParameterMetadata(operation, Constants.TRIGGER_ID_PARAM_NAME, Constants.TRIGGER_ID_PARAM_FRIENDLY_NAME, Constants.TRIGGER_ID_MAGIC_DEFAULT);
operation.SetVisibility(VisibilityType.Internal);
}
}
示例2: applyOperationMetadataAndVisibility
/// <summary>
/// Applies the friendly names, descriptions, and visibility settings to the operation
/// </summary>
/// <param name="operation">Exposed operation metadata</param>
/// <param name="apiDescription">Implementation metadata</param>
private static void applyOperationMetadataAndVisibility(Operation operation, ApiDescription apiDescription)
{
// Apply friendly names and descriptions where possible
// operation.summary - friendly name (applies to methods)
// operation.description - description (applies to methods)
// "x-ms-summary" - friendly name (applies to parameters and their properties)
// operation.parameters[x].description - description (applies to parameters)
var operationMetadataResults = apiDescription.ActionDescriptor.GetCustomAttributes<MetadataAttribute>();
var operationMetadata = operationMetadataResults == null ? null : operationMetadataResults.FirstOrDefault();
if (operationMetadata != null)
{
operation.SetFriendlyNameAndDescription(operationMetadata.FriendlyName, operationMetadata.Description);
operation.SetVisibility(operationMetadata.Visibility);
}
if (operation.parameters == null) return;
// Ensure that we get the parameters of the operation all annotated appropriately as well
applyOperationParameterMetadataAndVisibility(operation, apiDescription);
}