コード例 #1
0
        public ApiActionMeta GetApiAction(string groupName, string actionName)
        {
            if (actionName == null)
            {
                throw new ArgumentNullException(nameof(actionName));
            }

            ApiGroupMeta apiGroup = GetApiGroup(groupName).FirstOrDefault();

            if (apiGroup == null)
            {
                throw new InvalidOperationException(
                          $"The controller group name of: {groupName} was not configured.");
            }

            ApiActionMeta apiAction = apiGroup.Actions.FirstOrDefault(
                a => a.ActionName == actionName);

            if (apiAction == null)
            {
                throw new InvalidOperationException(
                          $"The controller action named: {actionName} for controller group: {groupName} is not configured.");
            }
            return(apiAction);
        }
コード例 #2
0
 private static IEnumerable <ParameterInfo> GetParameters(ApiActionMeta action)
 {
     return(action.Parameters
            .Select(p => new ParameterInfo {
         Name = p.ParameterName,
         IsOptional = p.IsOptional,
         DefaultValue = p.DefaultValue
     }));
 }