• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Compiler.ValidationManager类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Workflow.ComponentModel.Compiler.ValidationManager的典型用法代码示例。如果您正苦于以下问题:C# ValidationManager类的具体用法?C# ValidationManager怎么用?C# ValidationManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ValidationManager类属于System.Workflow.ComponentModel.Compiler命名空间,在下文中一共展示了ValidationManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Validate

        public override ValidationErrorCollection Validate(ValidationManager manager, object obj)
        {
            if (manager == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("manager");
            }

            ValidationErrorCollection validationErrors = ValidationHelpers.ValidateObject(manager, obj);
            if (validationErrors.Count == 0)
            {
                if (manager.Context == null)
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(
                        new InvalidOperationException(SR2.GetString(SR2.Error_ContextStackMissing)));
                }

                Activity rootActivity = manager.Context[typeof(Activity)] as Activity;
                if (rootActivity == null)
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(
                        new InvalidOperationException(SR2.GetString(SR2.Error_ContextStackItemMissing, typeof(Activity).Name)));
                }
                else
                {
                    validationErrors.AddRange(ValidationHelper.ValidateAllServiceOperationsImplemented(manager, rootActivity));
                }
            }

            return validationErrors;
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:30,代码来源:WorkflowServiceAttributesDynamicPropertyValidator.cs


示例2: GetFullPropertyName

        protected string GetFullPropertyName(ValidationManager manager)
        {
            if (manager == null)
                throw new ArgumentNullException("manager");

            string fullName = string.Empty;

            // iterate the properties in the stack starting with the last one
            int iterator = 0;
            while (manager.Context[iterator] != null)
            {
                if (manager.Context[iterator] is PropertyValidationContext)
                {
                    PropertyValidationContext propertyValidationContext = manager.Context[iterator] as PropertyValidationContext;
                    if (propertyValidationContext.PropertyName == string.Empty)
                        fullName = string.Empty;  // property chain broke... dicard properties after break
                    else if (fullName == string.Empty)
                        fullName = propertyValidationContext.PropertyName;
                    else
                        fullName = propertyValidationContext.PropertyName + "." + fullName;
                }
                iterator++;
            }

            return fullName;
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:26,代码来源:Validator.cs


示例3: Validate

 public override ValidationErrorCollection Validate(ValidationManager manager, object obj)
 {
     ValidationErrorCollection errors = base.Validate(manager, obj);
     StateFinalizationActivity compositeActivity = obj as StateFinalizationActivity;
     if (compositeActivity == null)
     {
         throw new ArgumentException(SR.GetString("Error_UnexpectedArgumentType", new object[] { typeof(StateFinalizationActivity).FullName }), "obj");
     }
     StateActivity parent = compositeActivity.Parent as StateActivity;
     if (parent == null)
     {
         errors.Add(new ValidationError(SR.GetError_StateFinalizationParentNotState(), 0x606));
         return errors;
     }
     foreach (Activity activity3 in parent.EnabledActivities)
     {
         StateFinalizationActivity activity4 = activity3 as StateFinalizationActivity;
         if ((activity4 != null) && (activity4 != compositeActivity))
         {
             errors.Add(new ValidationError(SR.GetError_MultipleStateFinalizationActivities(), 0x61a));
             break;
         }
     }
     if (StateMachineHelpers.ContainsEventActivity(compositeActivity))
     {
         errors.Add(new ValidationError(SR.GetError_EventActivityNotValidInStateFinalization(), 0x603));
     }
     return errors;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:29,代码来源:StateFinalizationValidator.cs


示例4: Validate

 public override ValidationErrorCollection Validate(ValidationManager manager, object obj)
 {
     ValidationErrorCollection errors = base.Validate(manager, obj);
     ParallelActivity activity = obj as ParallelActivity;
     if (activity == null)
     {
         throw new ArgumentException(SR.GetString("Error_UnexpectedArgumentType", new object[] { typeof(ParallelActivity).FullName }), "obj");
     }
     if (activity.EnabledActivities.Count < 2)
     {
         errors.Add(new ValidationError(SR.GetString("Error_ParallelLessThanTwoChildren"), 0x517));
     }
     bool flag = false;
     foreach (Activity activity2 in activity.EnabledActivities)
     {
         if (activity2.GetType() != typeof(SequenceActivity))
         {
             flag = true;
         }
     }
     if (flag)
     {
         errors.Add(new ValidationError(SR.GetString("Error_ParallelNotAllSequence"), 0x518));
     }
     return errors;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:26,代码来源:ParallelValidator.cs


示例5: Validate

        public override ValidationErrorCollection Validate(
            ValidationManager manager,
            object obj)
        {
            ValidationErrorCollection validationErrors = base.Validate(manager, obj);

            SendActivity sendActivity = obj as SendActivity;
            if (sendActivity == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("obj",
                    SR2.GetString(SR2.Error_ArgumentTypeInvalid, "obj", typeof(SendActivity)));
            }

            ITypeProvider typeProvider = manager.GetService(typeof(ITypeProvider)) as ITypeProvider;
            if (typeProvider == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(
                    SR2.GetString(SR2.General_MissingService, typeof(ITypeProvider).Name)));
            }

            if (sendActivity.ServiceOperationInfo == null)
            {
                validationErrors.Add(
                    new ValidationError(
                    SR2.GetString(SR2.Error_ServiceOperationInfoNotSpecified,
                    sendActivity.Name),
                    WorkflowServicesErrorNumbers.Error_OperationInfoNotSpecified,
                    false,
                    "ServiceOperationInfo"));
            }
            else
            {
                // validate operation info
                //
                ValidationErrorCollection operationInfoValidationErrors =
                    ValidationHelper.ValidateOperationInfo(
                    sendActivity,
                    sendActivity.ServiceOperationInfo,
                    manager);

                validationErrors.AddRange(operationInfoValidationErrors);

                // do not validate parameter binding if the operation info is not valid
                // we might generate noise and false positives.
                //
                if (operationInfoValidationErrors.Count == 0)
                {
                    validationErrors.AddRange(
                        ValidationHelper.ValidateParameterBindings(sendActivity, sendActivity.ServiceOperationInfo,
                        sendActivity.ParameterBindings, manager));
                }

                // validate the endpoint
                //
                validationErrors.AddRange(
                    ValidationHelper.ValidateChannelToken(sendActivity, manager));
            }

            return validationErrors;
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:60,代码来源:SendActivityValidator.cs


示例6: ValidateProperties

 public virtual ValidationErrorCollection ValidateProperties(ValidationManager manager, object obj)
 {
     if (manager == null)
     {
         throw new ArgumentNullException("manager");
     }
     if (obj == null)
     {
         throw new ArgumentNullException("obj");
     }
     ValidationErrorCollection errors = new ValidationErrorCollection();
     Activity activity = manager.Context[typeof(Activity)] as Activity;
     Walker walker = new Walker(true);
     walker.FoundProperty += delegate (Walker w, WalkerEventArgs args) {
         if ((args.CurrentProperty != null) && (DependencyProperty.FromName(args.CurrentProperty.Name, args.CurrentProperty.DeclaringType) == null))
         {
             object[] customAttributes = args.CurrentProperty.GetCustomAttributes(typeof(ValidationOptionAttribute), true);
             if (((customAttributes.Length > 0) ? ((ValidationOptionAttribute) customAttributes[0]).ValidationOption : ValidationOption.Optional) != ValidationOption.None)
             {
                 errors.AddRange(this.ValidateProperty(args.CurrentProperty, args.CurrentPropertyOwner, args.CurrentValue, manager));
                 args.Action = WalkerAction.Skip;
             }
         }
     };
     walker.WalkProperties(activity, obj);
     return errors;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:27,代码来源:Validator.cs


示例7: GetFullPropertyName

 protected string GetFullPropertyName(ValidationManager manager)
 {
     if (manager == null)
     {
         throw new ArgumentNullException("manager");
     }
     string propertyName = string.Empty;
     for (int i = 0; manager.Context[i] != null; i++)
     {
         if (manager.Context[i] is PropertyValidationContext)
         {
             PropertyValidationContext context = manager.Context[i] as PropertyValidationContext;
             if (context.PropertyName == string.Empty)
             {
                 propertyName = string.Empty;
             }
             else if (propertyName == string.Empty)
             {
                 propertyName = context.PropertyName;
             }
             else
             {
                 propertyName = context.PropertyName + "." + propertyName;
             }
         }
     }
     return propertyName;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:28,代码来源:Validator.cs


示例8: Validate

 public override ValidationErrorCollection Validate(ValidationManager manager, object obj)
 {
     ValidationErrorCollection errors = base.Validate(manager, obj);
     EventDrivenActivity activity = obj as EventDrivenActivity;
     if (activity == null)
     {
         throw new ArgumentException(SR.GetString("Error_UnexpectedArgumentType", new object[] { typeof(EventDrivenActivity).FullName }), "obj");
     }
     if ((!(activity.Parent is ListenActivity) && !(activity.Parent is EventHandlersActivity)) && !(activity.Parent is StateActivity))
     {
         errors.Add(new ValidationError(SR.GetError_EventDrivenParentNotListen(), 0x510));
     }
     string errorText = string.Empty;
     int errorNumber = -1;
     Activity activity2 = (activity.EnabledActivities.Count > 0) ? activity.EnabledActivities[0] : null;
     if (activity2 == null)
     {
         errorText = SR.GetString("Error_EventDrivenNoFirstActivity");
         errorNumber = 0x511;
     }
     else if (!(activity2 is IEventActivity))
     {
         errorText = SR.GetError_EventDrivenInvalidFirstActivity();
         errorNumber = 0x512;
     }
     if (errorText.Length > 0)
     {
         errors.Add(new ValidationError(errorText, errorNumber));
     }
     return errors;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:31,代码来源:EventDrivenValidator.cs


示例9: Validate

        public override ValidationErrorCollection Validate(ValidationManager manager, object obj)
        {
            ValidationErrorCollection validationErrors = base.Validate(manager, obj);

            EventDrivenActivity eventDriven = obj as EventDrivenActivity;
            if (eventDriven == null)
                throw new ArgumentException(SR.GetString(SR.Error_UnexpectedArgumentType, typeof(EventDrivenActivity).FullName), "obj");

            // check parent 
            if (!(eventDriven.Parent is ListenActivity) &&
                !(eventDriven.Parent is EventHandlersActivity) &&
                !(eventDriven.Parent is StateActivity)
                )
                validationErrors.Add(new ValidationError(SR.GetError_EventDrivenParentNotListen(), ErrorNumbers.Error_EventDrivenParentNotListen));

            // validate Event property
            string message = string.Empty;
            int errorNumber = -1;
            Activity firstActivity = (eventDriven.EnabledActivities.Count > 0) ? eventDriven.EnabledActivities[0] : null;
            if (firstActivity == null)
            {
                message = SR.GetString(SR.Error_EventDrivenNoFirstActivity);
                errorNumber = ErrorNumbers.Error_EventDrivenNoFirstActivity;
            }
            else if (!(firstActivity is IEventActivity))
            {
                message = SR.GetError_EventDrivenInvalidFirstActivity();
                errorNumber = ErrorNumbers.Error_EventDrivenInvalidFirstActivity;
            }
            if (message.Length > 0)
                validationErrors.Add(new ValidationError(message, errorNumber));

            return validationErrors;
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:34,代码来源:EventDriven.cs


示例10: Validate

 public override ValidationErrorCollection Validate(ValidationManager manager, object obj)
 {
     ValidationErrorCollection errors = new ValidationErrorCollection(base.Validate(manager, obj));
     ListenActivity activity = obj as ListenActivity;
     if (activity == null)
     {
         throw new ArgumentException(SR.GetString("Error_UnexpectedArgumentType", new object[] { typeof(ListenActivity).FullName }), "obj");
     }
     if (activity.EnabledActivities.Count < 2)
     {
         errors.Add(new ValidationError(SR.GetString("Error_ListenLessThanTwoChildren"), 0x513));
     }
     bool flag = false;
     foreach (Activity activity2 in activity.EnabledActivities)
     {
         if (!(activity2 is EventDrivenActivity))
         {
             flag = true;
         }
     }
     if (flag)
     {
         errors.Add(new ValidationError(SR.GetString("Error_ListenNotAllEventDriven"), 0x514));
     }
     return errors;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:26,代码来源:ListenValidator.cs


示例11: Validate

 public override ValidationErrorCollection Validate(ValidationManager manager, object obj)
 {
     ValidationErrorCollection errors = base.Validate(manager, obj);
     EventHandlersActivity activity = obj as EventHandlersActivity;
     if (activity == null)
     {
         throw new ArgumentException(SR.GetString("Error_UnexpectedArgumentType", new object[] { typeof(EventHandlersActivity).FullName }), "obj");
     }
     if (activity.Parent == null)
     {
         errors.Add(new ValidationError(SR.GetString("Error_MustHaveParent"), 0x522));
         return errors;
     }
     if (!(activity.Parent is EventHandlingScopeActivity))
     {
         errors.Add(new ValidationError(SR.GetString("Error_EventHandlersDeclParentNotScope", new object[] { activity.Parent.QualifiedName }), 0x522));
     }
     bool flag = false;
     foreach (Activity activity2 in activity.EnabledActivities)
     {
         if (!(activity2 is EventDrivenActivity))
         {
             flag = true;
         }
     }
     if (flag)
     {
         errors.Add(new ValidationError(SR.GetString("Error_ListenNotAllEventDriven"), 0x514));
     }
     return errors;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:31,代码来源:EventHandlersValidator.cs


示例12: Validate

 public override ValidationErrorCollection Validate(ValidationManager manager, object obj)
 {
     ValidationErrorCollection errors = base.Validate(manager, obj);
     if (!(obj is ConditionedActivityGroup))
     {
         throw new ArgumentException(SR.GetString("Error_UnexpectedArgumentType", new object[] { typeof(ConditionedActivityGroup).FullName }), "obj");
     }
     return errors;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:9,代码来源:ConditionedActivityGroupValidator.cs


示例13: Validate

        public virtual ValidationErrorCollection Validate(ValidationManager manager, object obj)
        {
            if (manager == null)
                throw new ArgumentNullException("manager");
            if (obj == null)
                throw new ArgumentNullException("obj");

            return new ValidationErrorCollection();
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:9,代码来源:Validator.cs


示例14: Validate

 public override ValidationErrorCollection Validate(ValidationManager manager, object obj)
 {
     ValidationErrorCollection errors = base.Validate(manager, obj);
     if (!(obj is ActivityCondition))
     {
         throw new ArgumentException(SR.GetString("Error_UnexpectedArgumentType", new object[] { typeof(ActivityCondition).FullName }), "obj");
     }
     errors.AddRange(this.ValidateProperties(manager, obj));
     return errors;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:10,代码来源:ConditionValidator.cs


示例15: Validate

 public override ValidationErrorCollection Validate(ValidationManager manager, object obj)
 {
     if (!(obj is CallExternalMethodActivity))
     {
         throw new ArgumentException(SR.GetString("Error_UnexpectedArgumentType", new object[] { typeof(CallExternalMethodActivity).FullName }), "obj");
     }
     ValidationErrorCollection errors = base.Validate(manager, obj);
     errors.AddRange(CorrelationSetsValidator.Validate(manager, obj));
     errors.AddRange(ParameterBindingValidator.Validate(manager, obj));
     return errors;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:11,代码来源:CallExternalMethodActivityValidator.cs


示例16: ValidateActivity

 internal static ValidationErrorCollection ValidateActivity(ValidationManager manager, Activity activity)
 {
     ValidationErrorCollection errors = ValidateObject(manager, activity);
     foreach (ValidationError error in errors)
     {
         if (!error.UserData.Contains(typeof(Activity)))
         {
             error.UserData[typeof(Activity)] = activity;
         }
     }
     return errors;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:12,代码来源:ValidationHelpers.cs


示例17: Validate

        public override ValidationErrorCollection Validate(ValidationManager manager, object obj)
        {
            ValidationErrorCollection validationErrors = base.Validate(manager, obj);

            ActivityCondition conditionDeclaration = obj as ActivityCondition;
            if (conditionDeclaration == null)
                throw new ArgumentException(SR.GetString(SR.Error_UnexpectedArgumentType, typeof(ActivityCondition).FullName), "obj");

            validationErrors.AddRange(ValidateProperties(manager, obj));

            return validationErrors;
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:12,代码来源:ConditionValidator.cs


示例18: Validate

 public override ValidationErrorCollection Validate(ValidationManager manager, object obj)
 {
     ValidationErrorCollection errors = base.Validate(manager, obj);
     MethodBind bind = obj as MethodBind;
     if (bind == null)
     {
         throw new ArgumentException(SR.GetString("Error_UnexpectedArgumentType", new object[] { typeof(MethodBind).FullName }), "obj");
     }
     PropertyValidationContext validationContext = manager.Context[typeof(PropertyValidationContext)] as PropertyValidationContext;
     if (validationContext == null)
     {
         throw new InvalidOperationException(SR.GetString("Error_ContextStackItemMissing", new object[] { typeof(BindValidationContext).Name }));
     }
     Activity activity = manager.Context[typeof(Activity)] as Activity;
     if (activity == null)
     {
         throw new InvalidOperationException(SR.GetString("Error_ContextStackItemMissing", new object[] { typeof(Activity).Name }));
     }
     ValidationError item = null;
     if (string.IsNullOrEmpty(bind.Name))
     {
         item = new ValidationError(SR.GetString("Error_PropertyNotSet", new object[] { "Name" }), 0x116) {
             PropertyName = base.GetFullPropertyName(manager) + ".Name"
         };
     }
     else
     {
         BindValidationContext context2 = manager.Context[typeof(BindValidationContext)] as BindValidationContext;
         if (context2 == null)
         {
             Type baseType = BindHelpers.GetBaseType(manager, validationContext);
             if (baseType != null)
             {
                 AccessTypes accessType = BindHelpers.GetAccessType(manager, validationContext);
                 context2 = new BindValidationContext(baseType, accessType);
             }
         }
         if (context2 != null)
         {
             Type targetType = context2.TargetType;
             if (item == null)
             {
                 errors.AddRange(this.ValidateMethod(manager, activity, bind, new BindValidationContext(targetType, context2.Access)));
             }
         }
     }
     if (item != null)
     {
         errors.Add(item);
     }
     return errors;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:52,代码来源:MethodBindValidator.cs


示例19: Validate

        /// <summary>
        ///	Overridden to validate the activity properties and populate the error collection.
        /// Only one child activity is allowed.  If multiple acitivties need to be executed,
        /// place them in a sequence or other appropriate composite activities.
        /// </summary>
        /// <param name="manager"></param>
        /// <param name="obj"></param>
        /// <returns></returns>
        public override ValidationErrorCollection Validate(ValidationManager manager, object obj)
        {
            ValidationErrorCollection validationErrors = new ValidationErrorCollection(base.Validate(manager, obj));

            ForEach foreachActivity = obj as ForEach;
            if (foreachActivity == null)
                throw new ArgumentException("Validate parameter 'obj' is not a ForEach activity.");

            if (foreachActivity.EnabledActivities.Count > 1)
                validationErrors.Add(new ValidationError("Only one child is allowed in the ForEach activity.", InvalidNumberOfChildren));

            return validationErrors;
        }
开发者ID:haimon74,项目名称:KanNaim,代码行数:21,代码来源:ForEachValidator.cs


示例20: Validate

        public override ValidationErrorCollection Validate(ValidationManager manager, object obj)
        {
            ValidationErrorCollection validationErrors = new ValidationErrorCollection(base.Validate(manager, obj));

            StateActivity state = obj as StateActivity;
            if (state == null)
                throw new ArgumentException(SR.GetString(SR.Error_UnexpectedArgumentType, typeof(StateActivity).FullName), "obj");

            // First we validate contaiment
            if (state.Parent != null)
            {
                if (StateMachineHelpers.IsStateMachine(state))
                {
                    validationErrors.Add(new ValidationError(SR.GetError_StateMachineWorkflowMustBeARootActivity(), ErrorNumbers.Error_StateMachineWorkflowMustBeARootActivity));
                    return validationErrors;
                }
                else
                {
                    // Make sure that a State is always contained in
                    // another State or StateMachineWorkflow. State machine
                    // within a sequential workflow is not supported
                    if (!(state.Parent is StateActivity))
                    {
                        validationErrors.Add(new ValidationError(SR.GetError_InvalidStateActivityParent(), ErrorNumbers.Error_InvalidStateActivityParent));
                        return validationErrors;
                    }
                }
            }

            if (state.Parent == null && !StateMachineHelpers.IsStateMachine(state))
            {
                ValidateCustomStateActivity(state, validationErrors);
            }

            if (StateMachineHelpers.IsLeafState(state))
            {
                ValidateLeafState(state, validationErrors);
            }
            else if (StateMachineHelpers.IsRootState(state))
            {
                ValidateRootState(state, validationErrors);
            }
            else
            {
                ValidateState(state, validationErrors);
            }

            ValidateEventDrivenActivities(state, validationErrors);

            return validationErrors;
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:51,代码来源:StateValidator.cs



注:本文中的System.Workflow.ComponentModel.Compiler.ValidationManager类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Design.ActivityDesigner类代码示例发布时间:2022-05-26
下一篇:
C# Compiler.ValidationError类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap